Script: time step keys

All about writing scripts for Celestia in Lua and the .cel system
Topic author
Harry
Posts: 559
Joined: 05.09.2003
With us: 21 years 2 months
Location: Germany

Script: time step keys

Post #1by Harry » 15.03.2004, 11:53

Hi,

as an answer to this feature request I have written a script which should change the current time by one solar day, one sidereal day or one year for every keypress.

Have a try:
http://www.h-schmidt.net/celestia/timestepkeys.celx

Start the script, select a planet, and press a/A to change by a year, s/S for a sidereal day, or d/D for a normal day.

Problems:
I had to use a fixed table of day/year-lengths because this information is not (yet) available to scripts. I used the values found in solarsys.ssc, but I don't know how to work with them: how do you compute the normal daylength? And I am not sure about the length of an earth-year either (365.25 is used within celestia) etc. The method I used is good enough to make the script usable, but probably not correct - and I am too lazy to look for information about this. 8)

Harald

don
Posts: 1709
Joined: 12.07.2003
With us: 21 years 4 months
Location: Colorado, USA (7000 ft)

Post #2by don » 15.03.2004, 17:51

Howdy Harald,

That script sure provides an interesting display. 8O

Thanks!
-Don G.
My Celestia Scripting Resources page

Avatar: Total Lunar Eclipse from our back yard, Oct 2004. Panasonic FZ1 digital camera (no telescope), 36X digital zoom, 8 second exposure at f6.5.

Topic author
Harry
Posts: 559
Joined: 05.09.2003
With us: 21 years 2 months
Location: Germany

Post #3by Harry » 17.03.2004, 07:54

I've just updated the script, and changed the way how the length of the solar day and sidereal year are computed - thanks to Grant for his help.

Please make sure you use suitable frames-of-reference, like
synchronous for solar days (if you want to keep the sun in your view)
follow/synchronous for sidereal days (to make the stars appear at the same position)
universal mode for sidereal years (to see the selected planet return after one year)

The last one is a bit impractical, because you have to press ESC, which also terminates the script - so you have to restart it.

Maybe the script should set a useful frame?

I didn't do a lot of testing, so please report errors here.

Harald


Return to “Scripting”