Solar System Mini Tour Script

All about writing scripts for Celestia in Lua and the .cel system
Topic author
L2Cache
Posts: 25
Joined: 19.01.2004
With us: 20 years 8 months

Solar System Mini Tour Script

Post #1by L2Cache » 23.01.2004, 01:08

Here's a script for a mini tour of the solar system (Sun, 9 planets, and our moon) I put together. It's designed as a brief introduction to the solar system for students, etc. Just copy and paste into a text editor; and save it as SolarMiniTour.cel

Code: Select all

# Start of Script ------------------------------------------------------------------
{
   #---------------------------------------------------------------------------
   # SolarMiniTour.cel  Version 1.0.0  Last updated on 1/22/2004
   # By L2Cache
   # With inspiration from the demo and other scipts and the script guide
   # Designed as a brief introduction to the solar system for students, etc.
   # Tested with Celestia 1.3.0 and 1.3.1-1 on 640x480 and 800x600 displays
   # The Sun spots will not show in lowres mode
   # In Celestia 1.3.1, make sure orbits for moons and planets are activated
   # So that the script can show them later when it needs to. On the menu bar,
   # Go to Render, View Options, Orbits/Lables and check Orbits for
   # Moons and Planets. Leave other Orbits unchecked.
   # To clear the extra text on the screen, press the v key a couple of times.
   # Set full screen mode to hide the title bar.
   #---------------------------------------------------------------------------

   cancel { }
   renderflags { clear "orbits|constellations|comettails|boundaries|markers" }
   renderflags { clear "eclipseshadows|pointstars" }
   renderflags { set "stars|planets|cloudmaps|nightmaps|ringshadows" }
   renderflags { set "galaxies|atmospheres" }
   labels { clear "stars|planets|moons|spacecraft|asteroids|constellations|galaxies" }
   set { name "FOV" value 150}
   set { name "AmbientLightLevel"       value 1.0 }

   select { object "Milky Way" }
   goto { time 4 }
   wait { duration 4 }
   print { text "Solar System Tour...
   Clear the extra text on the screen - press the v key
   once or twice. Hide the menu bar - Set full screen mode.
   If orbits don't show in Celestia 1.3.1, go to
   Render, View Options, Orbits/Lables and check Orbits
   for Moons and Planets. Leave other Orbits unchecked." row -7}
   wait { duration 15 }
   print { text " " row -2 }
   wait { duration 1.0 }
   set { name "FOV" value 140 }
   wait { duration 0.1 }
   set { name "FOV" value 130 }
   wait { duration 0.1 }
   set { name "FOV" value 120 }
   wait { duration 0.1 }
   set { name "FOV" value 110 }
   wait { duration 0.1 }
   set { name "FOV" value 100 }
   wait { duration 0.1 }
   set { name "FOV" value 90 }
   wait { duration 0.1 }
   set { name "FOV" value 80 }
   wait { duration 0.1 }
   set { name "FOV" value 70 }
   wait { duration 0.1 }
   set { name "FOV" value 60 }
   wait { duration 0.1 }
   set { name "FOV" value 50 }
   wait { duration 0.1 }
   set { name "FOV" value 40 }
   wait { duration 0.1 }
   set { name "FOV" value 27 }
   print { text "Our Galaxy, the Milky Way . . .
   If you can't see it, increase the monitor's brightness a little." row -3 }
   orbit { axis [ 0 1 0 ] rate 30 duration 15 }
   wait { duration 2.0 }

   set { name "AmbientLightLevel"       value 0.1 }
   print { text " " row -2 }
   wait { duration 1.0 }
   print { text "Starting Solar System Tour . . . Press ESC to end." row -2 }
   wait { duration 4.0 }

   labels { set "stars" }
   print { text " " row -2 }
   select { object "Sol" }
   set { name "FOV" value 32 }
   wait { duration 0.05 }
   set { name "FOV" value 37 }
   wait { duration 0.05 }
   set { name "FOV" value 41 }
   wait { duration 0.05 }
   set { name "FOV" value 45 }
   wait { duration 0.05 }
   goto { time 10 }
   wait { duration 10.0 }
   print { text "Let's start at the Sun with it's spots. . ." row -2 }
   orbit { axis [ 0 1 0 ] rate 30 duration 15 }
   wait { duration 2.0 }

   labels { clear "stars" }
   labels { set "planets" }
   print { text "Now on to Mercury . . ." row -2 }
   select { object "Sol/Mercury" }
   goto { time 15 }
   wait { duration 15.0 }
   orbit { axis [ 0 1 0 ] rate 30 duration 15 }
   wait { duration 2.0 }

   print { text "Then Venus . . ." row -2 }
   select { object "Sol/Venus" }
   goto { time 15 }
   wait { duration 15.0 }
   orbit { axis [ 0 1 0 ] rate 30 duration 15 }
   wait { duration 2.0 }

   print { text "And now, our Earth . . ." row -2 }
   select { object "Sol/Earth" }
   goto { time 15 }
   wait { duration 15.0 }
   orbit { axis [ 0 1 0 ] rate 30 duration 20 }
   wait { duration 2.0 }

   print { text "Let's see the Moon . . ." row -2 }
   select { object "Sol/Earth/Moon" }
   goto { time 15 }
   wait { duration 15.0 }
   orbit { axis [ 0 1 0 ] rate 30 duration 15 }
   wait { duration 2.0 }

   print { text "Show orbits and on to Mars . . ." row -2 }
   renderflags { set "orbits" }
   labels { set "moons" }
   select { object "Mars" }
   goto { time 15 }
   wait { duration 15.0 }
   renderflags { set "orbits" }
   orbit { axis [ 0 1 0 ] rate 30 duration 15 }
   wait { duration 2.0 }

   print { text "And Jupiter . . ." row -2 }
   select { object "Jupiter" }
   goto { time 15 }
   wait { duration 15.0 }
   orbit { axis [ 0 1 0 ] rate 30 duration 15 }
   wait { duration 2.0 }

   print { text "Then Saturn and it's rings. . ." row -2 }
   select { object "Saturn" }
   goto { time 15 }
   wait { duration 15.0 }
   orbit { axis [ 0 1 0 ] rate 30 duration 15 }
   wait { duration 2.0 }

   print { text "Now Uranus . . ." row -2 }
   select { object "Uranus" }
   goto { time 15 }
   wait { duration 15.0 }
   orbit { axis [ 0 1 0 ] rate 30 duration 15 }
   wait { duration 2.0 }

   print { text "And Neptune . . ." row -2 }
   select { object "Neptune" }
   goto { time 15 }
   wait { duration 15.0 }
   orbit { axis [ 0 1 0 ] rate 30 duration 15 }
   wait { duration 2.0 }

   print { text "At last, Pluto . . ." row -2 }
   select { object "Pluto" }
   goto { time 15 }
   wait { duration 15.0 }
   orbit { axis [ 0 1 0 ] rate 30 duration 15 }
   wait { duration 2.0 }

   print { text "And we head back home to Earth." row -2 }
   select { object "Sol/Earth" }
   goto { time 25 }
   wait { duration 25.0 }
   orbit { axis [ 0 1 0 ] rate 30 duration 25 }
   wait { duration 2.0 }
   renderflags { clear "orbits" }
   labels { clear "planets|moons" }
   print { text "The End." row -2 }
   wait { duration 3.0 }
}
# End of script ----------------------------------------------------

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

Post #2by don » 23.01.2004, 08:46

Howdy L2Cache,

Nice script! Thanks for sharing it with us. I like the way you used FOV settings to zoom-in. Very creative. :)

One suggestion ... at the beginning, you might want to separate each of the adjustment steps into a separate text display, or make the single display last longer. It's kind of hard to read it all, understand it, and actually *do* anything in that short time period.

Keep up the great work! :)

Cheers,

-Don G.

Topic author
L2Cache
Posts: 25
Joined: 19.01.2004
With us: 20 years 8 months

Post #3by L2Cache » 23.01.2004, 17:23

Thanks much. That text start bothers me too. I'll play around with it.

Topic author
L2Cache
Posts: 25
Joined: 19.01.2004
With us: 20 years 8 months

Post #4by L2Cache » 24.01.2004, 03:20

I've added a new intro onto the start that should help. I'll post the new code when the testing is done.

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

Post #5by don » 24.01.2004, 06:56

Sounds good. Looking forward to seeing it <smile>!

Topic author
L2Cache
Posts: 25
Joined: 19.01.2004
With us: 20 years 8 months

FOV problem in 1.3.1

Post #6by L2Cache » 27.01.2004, 18:01

I'm having field of view problems in 1.3.1 in both Windows 98SE and Red Hat Linux 9.0. I use an Nvidia Gforce 2MX card.
This is the new intro I'm working on. It sets the FOV at 45, then to 27, then back to 45. In 1.3.0, this works fine in windowed and full screen mode. In 1.3.1, it works fine in windowed mode; but if the user changes the window size, the FOV goes to 20. When I change to full screen mode, it starts out at FOV 22. Then the rest of the script works fine unless the menu bar is used. If the menu bar is accessed, thus changing the window size for a moment, the FOV goes to 22 again. Is this a problem with 1.3.1 or with my script?

Code: Select all

{
   cancel { }
   labels { clear "stars|galaxies|moons|planets|spacecraft" }   
   labels { clear "asteroids|constellations" }   
   renderflags { clear "galaxies|stars|planets|orbits|comettails|boundaries|markers" }
   renderflags { clear "eclipseshadows|pointstars|constellations" }
   set { name "FOV" value 45 }
   renderflags { set "cloudmaps|nightmaps|ringshadows|atmospheres" }

   set { name "StarDistanceLimit" value 3 }
   select { object "Sol" }
   renderflags { set "stars|planets|orbits" }
   labels { set "stars|planets" }
   gotolonglat {time 2 distance 1470 up [0 1 0] longitude 0 latitude 90 }   
   print { text "Solar System Tour - Press ESC to end.
   Now showing planet orbits around the sun
   If the orbits don't show in Celestia 1.3.1, go to
   Render, View Options, Orbits/Lables and check Orbits
   for Moons and Planets. Leave other Orbits unchecked." row -6}
   wait { duration 17.0 }
   gotolonglat {time 2 distance 3350 up [0 1 0] longitude 0 latitude 90 }
   wait { duration 9.0 }
   print { text "To clear the extra text on the screen, press the v key
   once or twice. To hide the menu bar, set full screen mode." row -3 }
   gotolonglat {time 2 distance 6900 up [0 1 0] longitude 0 latitude 90 }
   wait { duration 7.0 }
   gotolonglat {time 2 distance 17000 up [0 1 0] longitude 0 latitude 90 }
   wait { duration 5.0 }
   gotolonglat {time 2 distance 33000 up [0 1 0] longitude 0 latitude 90 }
   wait { duration 4.0 }
   gotolonglat {time 2 distance 55000 up [0 1 0] longitude 0 latitude 90 }
   print { text " " row -2 }
   wait { duration 5.0 }

   renderflags { clear "orbits|stars|planets" }
   labels { clear "stars|planets" }
   set { name "FOV" value 170 }
   select { object "Milky Way" }
   gotolonglat {time 2 up [0 1 0] longitude 0 latitude 0 }
   wait {duration 2.0 }
   set { name "AmbientLightLevel"       value 1.0 }
   renderflags { set "galaxies" }
   wait { duration 1.0 }
   print { text "Our Galaxy, the Milky Way . . .
   If you can't see it, increase the monitor's brightness a little." row -3 }
   set { name "FOV" value 140 }
   wait { duration 0.1 }
   set { name "FOV" value 130 }
   wait { duration 0.1 }
   set { name "FOV" value 120 }
   wait { duration 0.1 }
   set { name "FOV" value 110 }
   wait { duration 0.1 }
   set { name "FOV" value 100 }
   wait { duration 0.1 }
   set { name "FOV" value 90 }
   wait { duration 0.1 }
   set { name "FOV" value 80 }
   wait { duration 0.1 }
   set { name "FOV" value 70 }
   wait { duration 0.1 }
   set { name "FOV" value 60 }
   wait { duration 0.1 }
   set { name "FOV" value 50 }
   wait { duration 0.1 }
   set { name "FOV" value 40 }
   wait { duration 0.1 }
   set { name "FOV" value 27 }
   orbit { axis [ 0 1 0 ] rate 30 duration 18 }
   wait { duration 2.0 }

   renderflags { set "stars|planets" }
   set { name "AmbientLightLevel"       value 0.1 }
   set { name "StarDistanceLimit" value 1000000 }
   print { text "Starting Solar System Tour . . ." row -2 }
   wait { duration 5.0 }
   labels { set "stars" }
   select { object "Sol" }
   set { name "FOV" value 32 }
   wait { duration 0.05 }
   set { name "FOV" value 37 }
   wait { duration 0.05 }
   set { name "FOV" value 41 }
   wait { duration 0.05 }
   set { name "FOV" value 45 }
   wait { duration 0.05 }
   print { text " " row -2 }
   goto { time 10 }
   wait { duration 10.0 }
   print { text "Let's start at the Sun with it's spots. . ." row -2 }
   orbit { axis [ 0 1 0 ] rate 30 duration 15 }
   wait { duration 2.0 }
}

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

Post #7by don » 27.01.2004, 20:33

From what I've been able to determine, Celestia sets the initial FOV based on your window size -AND- it re-sets the FOV everytime you resize the window.

Can't remember if this was the case prior to 1.3.1.

Topic author
L2Cache
Posts: 25
Joined: 19.01.2004
With us: 20 years 8 months

Post #8by L2Cache » 28.01.2004, 04:54

I've tested it in 1.3.0 in windows and linux; and the FOV stays at what the script has set even when the window is resized.
I'm thinking I'll just do a workaround and change my FOV to 21 and adjust my distances in the script to see if this avoids the problem.

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

Post #9by don » 29.01.2004, 01:17

I think that regardless of what you set it at, in 1.3.1 + it will be changed anytime the window is resized. I'm not sure why this was added, as it seems backwards to me. When the window is made smaller, the FOV is set *higher*, instead of *lower*, like I would expect it to be. Oh well. I'm just a very strange person I guess. :lol:

Let us know how it comes out L2Cache!

-Don G.

Topic author
L2Cache
Posts: 25
Joined: 19.01.2004
With us: 20 years 8 months

FOV bug in 1.3.1?

Post #10by L2Cache » 29.01.2004, 17:25

I think it may be a bug, since it's not a good way for a program to behave.
I've changed my FOV to 21 in the script; and testing is going well.


Return to “Scripting”