Scripts

General discussion about Celestia that doesn't fit into other forums.
Topic author
alan_federman
Posts: 60
Joined: 10.01.2003
With us: 21 years 11 months
Location: Silicon Valley

Scripts

Post #1by alan_federman » 13.01.2003, 22:46

I have written a script (well it worked for 1.2.4) on retrograde rotation.



http://explorer.arc.nasa.gov/Celestia/jovian.cel



I plan to write some other scripts to illustrate common phenomena such as seasonal change, lunar phases, etc. If you have some scripts you'd like to share, please post them.

AND - if anyone has a document that explains and lists the new scripting
options (duration and row number) in print directives, please share the wealth!

Finally 1.2.5 seems to run well, but I have found that some machines happy with 4, crash with 5. Also scripts need to be modified.
Alan Federman

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 8 months
Location: Hamburg, Germany

Looking for Pan

Post #2by t00fri » 13.01.2003, 23:14

Here is a script that I wrote a little while ago. It's about Pan, a little moon of Saturn orbiting in the Encke division...

I hacked it to debug various scripting commands like 'move', ...

Bye Fridger

-----------------------------------
{
labels {clear "moons" }
setambientlight {brightness 0.15}
setfaintestautomag45deg { magnitude 10.5 }
time { jd 2452452.20 }
renderflags { set "galaxies" }
time { jd 2452452.68056 }
select { object "Sol/Saturn/Pan" }
gotolonglat { time 5 distance 50000 up [ 0 1 0 ] longitude 145.462 latitude 37.168 }
print { text "Looking for the tiny Saturn moon Pan in the outer Encke ring division. . ." row -3 duration 5 }
wait {duration 5}
changedistance { rate -1.3 duration 2 }
setambientlight {brightness 0.3}
print { text "Can you see now the little bright dot?. . ." row -3 duration 5 }
labels { set "moons" }
wait { duration 0.5 }
labels {clear "moons" }
wait { duration 0.5 }
labels { set "moons" }
wait { duration 0.5 }
labels {clear "moons" }
wait { duration 0.5 }
labels { set "moons" }
chase {}
wait { duration 2 }
print { text "Closing in. . ." row -3 duration 5 }
gotolonglat { time 6 distance 1.5 up [ -1 1 0 ] longitude 160.997 latitude 43.628 }
wait { duration 6 }
setambientlight {brightness 0.15}
labels {clear "moons" }
rotate { axis [-1 0 0] rate 10 duration 3 }
wait { duration 4 }
print { text "Accelerate time by a factor of 1000 " row -3 duration 5 }
timerate { rate 1000 }
wait { duration 10 }
move { velocity [ -0.5 2.0 0 ] duration 2.2 }
wait { duration 3 }
print { text "Slow down time again" row -3 duration 5 }
timerate { rate 100 }
move { velocity [ 0.5 -2.0 0 ] duration 2.2 }
wait { duration 2.2 }
chase {}
print { text "Chasing mode to display Pan's irregular motion. . ." row -3 duration 5 }
timerate { rate -5000 }
wait {duration 8 }
print { text "Locking mode. . ." row -3 duration 5 }
timerate { rate -500 }
lock {}
wait { duration 6.5 }
setframe { coordsys "observer" ref "Sol/Saturn/Pan" target "Sol/Saturn/Pan" }
timerate { rate 5000 }
wait { duration 6 }
select {object "Sol/Saturn" }
timerate { rate 1000 }
center { time 2 }
changedistance { rate 2.5 duration 2 }
wait { duration 4 }
select {object "Sol" }
print { text "Now leaving the ring system. . ." row -3 duration 5 }
follow {}
wait {duration 12 }
select {object "Sol/Saturn" }
goto { time 2 distance 5 }
wait {duration 2}
orbit { duration 3 rate 5.5 axis [1 0 0] }
print { text "Leaving Saturn . . . end of demo" row -3 duration 10 }
changedistance { rate 2 duration 12 }
setfaintestautomag45deg { magnitude 8.5 }
setambientlight { brightness 0 }
}

Calculus
Posts: 216
Joined: 19.10.2002
With us: 22 years 1 month
Location: NY

Post #3by Calculus » 13.01.2003, 23:27

It is a very good idea.
But your script doesn't work well on my Celestia.
First you need to reset all parameters (like FOV to 45, speed, etc...).
I can't see your comments. You have to add the "row -3" command in the print brakets.

I'm looking forward to running all your scenarii.
---Paul
My Gallery of Celestial Phenomena:
http://www.celestiaproject.net/gallery/view_al ... e=Calculus

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 8 months
Location: Hamburg, Germany

Post #4by t00fri » 13.01.2003, 23:40

Calculus wrote:It is a very good idea.
But your script doesn't work well on my Celestia.
First you need to reset all parameters (like FOV to 45, speed, etc...).
I can't see your comments. You have to add the "row -3" command in the print brakets.

I'm looking forward to running all your scenarii.


Strange, the script is definitely for 1.2.5 and runs excellently on my machine. Usually Celestia starts off with FoV=45 deg's. Clearly, the script is not polished, since I hacked it for debugging purposes, but I have not set anything special in my start.cel. Hence with a default 1.2.5 setup it should work well.

Perhaps, there was some mistake in copying the script from the WEB?

Try getting it from here:

http://www.celestiaproject.net/~t00fri/images/ ... andemo.cel

Bye Fridger

Calculus
Posts: 216
Joined: 19.10.2002
With us: 22 years 1 month
Location: NY

Post #5by Calculus » 14.01.2003, 02:44

Strange, the script is definitely for 1.2.5 and runs excellently on my machine. Usually Celestia starts off with FoV=45 deg's. Clearly, the script is not polished, since I hacked it for debugging purposes, but I have not set anything special in my start.cel. Hence with a default 1.2.5 setup it should work well.

Perhaps, there was some mistake in copying the script from the WEB?



I actually launched the script with a 3" FOV set in Celestia. I couldn't see anything. About the text, I was able to see it only after I added "row -3" in the file!
I don't know why. Maybe its because of the screen resolution (1024*768*32).
---Paul

My Gallery of Celestial Phenomena:

http://www.celestiaproject.net/gallery/view_al ... e=Calculus

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 8 months
Location: Hamburg, Germany

Post #6by t00fri » 14.01.2003, 09:32

Calculus wrote:
Strange, the script is definitely for 1.2.5 and runs excellently on my machine. Usually Celestia starts off with FoV=45 deg's. Clearly, the script is not polished, since I hacked it for debugging purposes, but I have not set anything special in my start.cel. Hence with a default 1.2.5 setup it should work well.

Perhaps, there was some mistake in copying the script from the WEB?


I actually launched the script with a 3" FOV set in Celestia. I couldn't see anything. About the text, I was able to see it only after I added "row -3" in the file!
I don't know why. Maybe its because of the screen resolution (1024*768*32).


Resolutions were definitely different, since I use 1600x1200x16. Yet in each of my print statements, there is a "row -3". What else are you suggesting??

Bye Fridger

Calculus
Posts: 216
Joined: 19.10.2002
With us: 22 years 1 month
Location: NY

Post #7by Calculus » 14.01.2003, 13:45

Sorry Fridger, I was not reffering to your script but alan's one.
I haven't tried yours yet.
---Paul

My Gallery of Celestial Phenomena:

http://www.celestiaproject.net/gallery/view_al ... e=Calculus

Kendrix
Posts: 159
Joined: 02.06.2002
With us: 22 years 6 months
Location: near Paris, France
Contact:

Post #8by Kendrix » 14.01.2003, 15:15

The set FOV command doesn't work in Celestia 1.2.5...

Unless I mistyped it ! -> set { FOV 35.0 }

I have also tried set { "FOV" 35 } and some others tries...

Nothing works...

As well as the Autofaintestmag feature (changing with the FOV) that doesn't work too !

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 8 months
Location: Hamburg, Germany

Post #9by t00fri » 14.01.2003, 17:20

Kendrix wrote:The set FOV command doesn't work in Celestia 1.2.5...

Unless I mistyped it ! -> set { FOV 35.0 }

I have also tried set { "FOV" 35 } and some others tries...

Nothing works...

As well as the Autofaintestmag feature (changing with the FOV) that doesn't work too !


set {FOV float} is indeed not yet implemented.

setfaintestautomag45deg{ magnitude float} I have coded and it /does/ work. You can convince yourself by running my script above.

Nothing else in this context has ever been implemented, hence it cannot work;-).

The toggling of Automag so far can
only been done by means of key shortcuts (CTRL Y). Again, I have coded it and it does work.

Whoever is interested to find out what commands are implemented and how their arguments are used, is advised to have a look at the routine src/celengine/cmdparser.cpp in the sources. In the CVS archive this single file can easily be inspected.

Even non-programmers should be able to find their way (I hope;-)).

Bye Fridger

Kendrix
Posts: 159
Joined: 02.06.2002
With us: 22 years 6 months
Location: near Paris, France
Contact:

Post #10by Kendrix » 14.01.2003, 17:36

Ok... I thought that the automag was enabled by default...

For the FOV I have seen that it wasn't in the cmdparser.cpp but since It was written in the changelog I thought it was elsewhere in the code ;o)

This evening I will start to add an opposition finder for Celestia...

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 8 months
Location: Hamburg, Germany

Post #11by t00fri » 14.01.2003, 17:43

Kendrix wrote:Ok... I thought that the automag was enabled by default...

For the FOV I have seen that it wasn't in the cmdparser.cpp but since It was written in the changelog I thought it was elsewhere in the code ;o)

This evening I will start to add an opposition finder for Celestia...


In the Linux gtk version I have enabled AutoMag by default. In the new KDE version your preferences are saved automatically, so once you switch it on by means of CTRL Y it will always be on...

In Windows it is off by default (well I have no Windows compiler;-))

setfaintestautomag45deg{} is important as to the FOV dependent characteristics of the AutoMag feature. That's why I made it resettable via a script.

Bye Fridger
Last edited by t00fri on 14.01.2003, 17:45, edited 1 time in total.

Calculus
Posts: 216
Joined: 19.10.2002
With us: 22 years 1 month
Location: NY

Post #12by Calculus » 14.01.2003, 17:44

Fridger,
I've noticed you use the "chase" function. Could you please explain what it is ? (it looks similar to the lock function).
---Paul

My Gallery of Celestial Phenomena:

http://www.celestiaproject.net/gallery/view_al ... e=Calculus

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 10 months
Location: Seattle, Washington, USA

Post #13by chris » 14.01.2003, 20:05

Kendrix wrote:The set FOV command doesn't work in Celestia 1.2.5...

Unless I mistyped it ! -> set { FOV 35.0 }

I have also tried set { "FOV" 35 } and some others tries...

Nothing works...

As well as the Autofaintestmag feature (changing with the FOV) that doesn't work too !

The set command should work for FOV . . . Celestia's script syntax is a bit peculiar, however, so you need to write:

Code: Select all

set { name "FOV" value 35.0 }


--Chris

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 8 months
Location: Hamburg, Germany

Post #14by t00fri » 14.01.2003, 20:27

chris wrote:The set command should work for FOV . . . Celestia's script syntax is a bit peculiar, however, so you need to write:

Code: Select all

set { name "FOV" value 35.0 }


--Chris


Yes, indeed, it works and after looking into the code, it's obvious. Coded before my time...;-)

Bye Fridger

Kendrix
Posts: 159
Joined: 02.06.2002
With us: 22 years 6 months
Location: near Paris, France
Contact:

Post #15by Kendrix » 14.01.2003, 22:05

thanx !

Topic author
alan_federman
Posts: 60
Joined: 10.01.2003
With us: 21 years 11 months
Location: Silicon Valley

Polish

Post #16by alan_federman » 21.01.2003, 22:56

I have polished the jovian.cel script a bit to add the row -3 command. I also have added another script: tutorial.cel to the web page. The idea being to demo and teach a new user the basics in one script.

If any one has a document about the 'undocumented' features of the scripting language - please post it!

http://explorer.arc.nasa.gov/Celestia
Alan Federman

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 3 months
Location: NY, USA

Post #17by selden » 21.01.2003, 23:04

Alan,

A cryptic summary of the scripting commands available in Celestia v1.2.5 is included in my "notes" page at http://www.lns.cornell.edu/~seb/celestia/celestia_notes.html#4.0

I say "cryptic" because it doesn't include the units that Celestia assumes are being provided: they aren't mentioned in the source files I looked at. I hope this helps a little, though.
Selden

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 3 months
Location: NY, USA

Post #18by selden » 21.01.2003, 23:25

Alan,

I'd suggest using significantly longer pauses in your tutorial script:
2 or 3 x as much, at least.

For one thing, you need to allow for the "dead time" while textures are being loaded, especially if they're high resolution. Although Celestia seems to "freeze" while it's loading a texture, the realtime clock keeps ticking, and that's what controls what gets shown. If it takes a long time to load a texture, all of the events that might have been seen during that time are discarded. I missed several of the introductory messages while the earth textures loaded.

This also can be compensated for by preloading the appropriate textures, assuming you know what they are, of course. I'd suggest assuming the standard set and leave it to the "Celestia system manager" to make appropriate changes if others have been installed.

Also, a novice needs some time to read the information and then relate it to what's on the screen.

Related suggestion: instead of completely replacing the previous text,
you might want to consider "scrolling" the messages: reetyping several previous lines a row higher each time a new line is written. This ensures that the user hasn't missed anything while admiring the view.

That kept happening to me. I was watching what was happening and missing what was being "said".

I hope these suggestions help a little.
Selden

Topic author
alan_federman
Posts: 60
Joined: 10.01.2003
With us: 21 years 11 months
Location: Silicon Valley

Post #19by alan_federman » 22.01.2003, 19:55

[quote="selden"]
Alan,

I'd suggest using significantly longer pauses in your tutorial script:
2 or 3 x as much, at least.



Thanks for the hint - hard to know how fast/slow things run 'out there' I try the script on a couple of different machines of different speeds to get a feel for it - but I don't want to bore anyone with long waits.
I also will check out the new scripting commands.

Do you think making the Tutorial a script would be a good thing for newbies?
Alan Federman

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 10 months
Location: Seattle, Washington, USA

Post #20by chris » 22.01.2003, 20:12

Any suggestions on how to improve text display in scripts are appreciated. For one, the "scrolling" behavior mentioned by selden sounds like something that should be built in.

--Chris


Return to “Celestia Users”