my first .cel script

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

my first .cel script

Post #1by dos » 28.03.2004, 15:32

Hello!

Please, take a look at

http://student.fizika.org/~dsvilko/explore.cel.gz
or
http://student.fizika.org/~dsvilko/explore.cel

This is my first script so please, be gentle :)

The script is quite large but it is probably the fastest written
Celestia script to this day - it was written in 0.18 seconds :)
Yap, it's 100% artificialy generated - no hand written line in there!

The perl script that build it is quite advanced. Give it a few
.ssc files and it generates a random tour using those objects.
It looks for things like object type, rotation period and orbit
parametars when deciding the best way to 'tour' that object.
You can even use location .ssc files to enable sightseeing tours. :)
Ill post the perl script when it's finished.

Tell me what you think.

Best wishes,
DoS

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

Post #2by don » 28.03.2004, 20:22

Hello dos,

For a script that writes a script, this is an excellent first attempt! Congratulations.

A couple of minor spelling changes:
... * "Turist" to "Tourist"
... * When viewing locations: "this is..." to "This is..."

A couple of things to consider adding / changing in your perl script:
... * Keep track of objects already added to the cel script. There are a lot of duplicates and triplicates in the cel script (ie. 3 trips to Venus).

... * Check for Beginning and Ending statements in .ssc files. If one exists, then check the ending date and make sure the cel script uses a date *before* this date (ie. Mir).

... * Define some kind of "order" in which to visit objects. For example:

Code: Select all

Planet
  Locations
  Spacecraft
  Moon
    Locations
  Moon
    Locations
Asteroids
Comets

... * Define the parent body for moons, for example: "Earth: Moon".

... * Since some folks have ambient light normally set to NONE, you might want the script to set it to a specific value, since there is a lot of sightseeing on the dark side of objects.

... * This one might take some playing with ... When going through Locations maybe obtain all longs / lats first, then sort, then write out the script code. Currently, if the next long / lat is on the opposite side of the object, the script goes *through* the object. Another way to get there would be to use the orbit command, but it's a lot trickier then.

Like I wrote above, EXCELLENT first attempt dos! Looking forward to seeing the next version's output.
-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.

Guest

Post #3by Guest » 29.03.2004, 08:12

don wrote:Hello dos,

For a script that writes a script, this is an excellent first attempt! Congratulations.
Thanks!

A couple of minor spelling changes:
... * "Turist" to "Tourist"
... * When viewing locations: "this is..." to "This is..."

Ups... :oops:

A couple of things to consider adding / changing in your perl script:
... * Keep track of objects already added to the cel script. There are a lot of duplicates and triplicates in the cel script (ie. 3 trips to Venus).

Yes, this was on my todo list.

... * Check for Beginning and Ending statements in .ssc files. If one exists, then check the ending date and make sure the cel script uses a date *before* this date (ie. Mir).

Ok, will do.

... * Define some kind of "order" in which to visit objects. For example:
The script can be run it two ways: random order or ssc order. That should take
care of it. It is my opinion that touring 10 asteroids in a row can become quite
boring.
The script was originally written for building very large 'demo' or screensaver-like
.cel scripts to show of celestia features. You can also generate large amount of
random scripts as a single script soon gets boring to watch. That randomness is
(in my opinion) it's strongest point.

... * Define the parent body for moons, for example: "Earth: Moon".

What do you mean? The probability that the object's parent body will be mentioned
or shown is quite large.

... * Since some folks have ambient light normally set to NONE, you might want the script to set it to a specific value, since there is a lot of sightseeing on the dark side of objects.

Will do...

... * This one might take some playing with ... When going through Locations maybe obtain all longs / lats first, then sort, then write out the script code. Currently, if the next long / lat is on the opposite side of the object, the script goes *through* the object. Another way to get there would be to use the orbit command, but it's a lot trickier then.

Excelent sugestion! I prefer the other one because just sorting the list doesn't
solve the problem (in case there are just a few sites).
I will probably add a quick mid-jump (quite easy to do) as the orbiting code would be
far more complicated.

Like I wrote above, EXCELLENT first attempt dos! Looking forward to seeing the next version's output.


Thanks again! And thank you for the excelent .cel scripting tutorial!

DoS

Guest

Post #4by Guest » 29.03.2004, 09:57

I made a few slight changes to the perl script and generated a fast
outer solar-system tour: http://student.fizika.org/~dsvilko/outer.cel

Hope U like it.

DoS

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

Post #5by don » 29.03.2004, 21:47

dos wrote:
... * Define some kind of "order" in which to visit objects. For example:
The script can be run it two ways: random order or ssc order. That should take care of it. It is my opinion that touring 10 asteroids in a row can become quite boring.
Good point about asteroids.


dos wrote:
... * Define the parent body for moons, for example: "Earth: Moon".
What do you mean? The probability that the object's parent body will be mentioned or shown is quite large.
Your first script bounced around to a lot of random moons, of different planets, without saying what planet they belong to. Many folks (like me) don't know all the names of the moons and who they belong to. So, when randomly going to moons, it would be helpful to know who it's parent (planet) is.


dos wrote:And thank you for the excelent .cel scripting tutorial!

My pleasure. It's GREAT to see what kind of scripts people come up with! :D
-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.

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

Post #6by don » 29.03.2004, 21:58

Anonymous wrote:I made a few slight changes to the perl script and generated a fast outer solar-system tour: http://student.fizika.org/~dsvilko/outer.cel

Hope U like it.

I LIKE it, I LIKE it :D.

Sure hope other folks like it too!

Your addition of markers is a nice idea. One suggestion on these ... if they are over a certain size (like the size of the body itself 8O ), it might look better if they were limited to a smaller size.

Also like your implementation of ramping up and down the ambient light setting. Nice touch! :D

However, when I ran this script (about 1:00pm MST USA) several of the moons had their dark side facing me when traveled to. Then, if there were no tourist traps on that moon, the ambient light was never set up at all. Not sure how to work around this one.

You must be quite good at perl to be doing this. Looking forward to seeing the perl script too.

Keep up the great work DoS!

Cheers,
-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
dos
Posts: 8
Joined: 28.03.2004
With us: 20 years 7 months

Post #7by dos » 31.03.2004, 01:11

Thanks Don for your support!

I made a few updates:
- corrected the location-too-large bug
- better rotation code
- things are now even smoother
- much better randomization code
... and a few suprises :)

You can see the results here:
http://student.fizika.org/~dsvilko/random2.cel
http://student.fizika.org/~dsvilko/tour2.cel

The first is a random demo and the other is a .ssc ordered tour.
Scripts are quite large (0.5MB) - try writing that by hand :D

If there are no more ugly bugs, I'll release the perl script so you can build
your own .cel tours - taylored for your setup!

Bye,
DoS

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

Post #8by don » 31.03.2004, 06:02

Hi DoS,

Just sat through your new random2.cel. Yep, all 15,349 lines of it. 8O

Loved the surprises:
... Earth-based size comparisons
... Location sizes
... Sol and planet sets
... Display planet then it's moon, or add planet name in parens
... Stripping Venus of it's clouds

Good work on getting MIR to display properly also.

Nice job DoS! :D

FYI, the center option in the print command does not center the text, like one would expect. Rather, it starts displaying the beginning of the text in the center of the window. So, you might want to adjust the opening text accordingly.

A couple things I noticed in this particular script:
... Charon's radius is 593 km but the perl script picked a 10 m comparison size.
... Borrelly "in orbit around Sol" was done twice, back-to-back.
... Ariel is shown twice (maybe defined twice in your .ssc files?).

Very impressive work DoS!!! 8)

(I'll go run tour2 now...)
-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.

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

Post #9by don » 31.03.2004, 06:23

Question: Does your perl script use constants (defined at the top of the script) to set the number of seconds to display text under different circumstances? For example, displaying the object name, a location name, etc.

What about other things that might be good candidates for constants, that a user might want to change, such as sunset durations, ambient light min/max, FOV min/max, etc.?
-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.

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

Post #10by don » 31.03.2004, 06:36

Hi DoS,

Your tour2 script looks real good too. The Charon problem exists here too, but the Borrelly and Ariel problems do not.
-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.

Guest

Post #11by Guest » 31.03.2004, 15:45

Just sat through your new random2.cel. Yep, all 15,349 lines of it.
Wow! Even I didn't sit through the whole thing! :)
Nice job DoS!
Thanks!
FYI, the center option in the print command does not center the text,
like one would expect. Rather, it starts displaying the beginning of the text
in the center of the window. So, you might want to adjust the opening text
accordingly.
Yes, I know. Will try to fix it.
A couple things I noticed in this particular script:
... Charon's radius is 593 km but the perl script picked a 10 m comparison size.
Fixed. There was a bug in the .ssc parser.
... Borrelly "in orbit around Sol" was done twice, back-to-back.
Only the text was the same. The 'Revolve-view / Parent-quick-look' and the
'orbit-view' have (had) a few duplicated messages. I removed those messages
so now it should be even more random.
... Ariel is shown twice (maybe defined twice in your .ssc files?).
With current randomization code there is a _very_ small chance that something
like this will happen. Other 5 test runs had no duplicates. In case there
is a duplicate, the time between the two instances should be quite large.
For example, with 50 object .ssc file, the script can produce a 500
object tour with excelent randomness (most duplicates with more then
30 objects between them). Anyway, I like the slight unpredictability. :)
Question: Does your perl script use constants (defined at the top of the
script) to set the number of seconds to display text under different
circumstances? For example, displaying the object name, a location name, etc.
What about other things that might be good candidates for constants, that a
user might want to change, such as sunset durations, ambient light min/max,
FOV min/max, etc.?

The script has a lot of constants defined (most of the things you would
wish to change) but for some timings it is necessary to change the code
by hand. If you feel there is a timing that is way off, let me know and I'll
either fix it or add a constant.

Once again, thanks for great sugestions and bug reports!
I think the script is ready for the public (beta) use. You can download it
from: http://student.fizika.org/~dsvilko/explore.pl
It started as a quick, small, proof-of-concept perl script but ended
a bit on a longish side. As I didn't plan things in advance, the
script is internally quite ugly.

For those non-unix havent-heard-of-perl people out there, here are a
new .cel scripts that tours the planets/moons with atmospheres
(showing off a new sunset mode):
http://student.fizika.org/~dsvilko/atmosphere.cel

DoS

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

Post #12by don » 01.04.2004, 09:53

Hi DoS,

Thanks for your reply and further descriptions.

dos wrote:The script has a lot of constants defined (most of the things you would wish to change) but for some timings it is necessary to change the code by hand. If you feel there is a timing that is way off, let me know and I'll either fix it or add a constant.
No major complaints. It's a bit fast-moving for me (I read slow), but it keeps the pace going, which is good. There was one instance in the random2 script where some text flashed too quick to read, but only that one that I remember, out of the thousands.


dos wrote:I think the script is ready for the public (beta) use. You can download it from:
WOW! Nice script! 8O
Lots of comments too :D . Thank you for sharing it with us DoS!


dos wrote:For those non-unix havent-heard-of-perl people out there,

A search on SourceForge will turn up several easy-to-install versions of the Apache web server for Windows, which can include perl (among others). I think there are also some perl-only installations for Windows, somewhere out there ... check Google.

Thanks again DoS!
-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.

Gordon
Posts: 83
Joined: 17.04.2003
With us: 21 years 7 months
Location: Paris, France

Post #13by Gordon » 02.04.2004, 12:21

don wrote:Hi DoS,
dos wrote:For those non-unix havent-heard-of-perl people out there,
A search on SourceForge will turn up several easy-to-install versions of the Apache web server for Windows, which can include perl (among others). I think there are also some perl-only installations for Windows, somewhere out there ... check Google.

Thanks again DoS!


Hello,

I have tried an exe converter perl2exe from here http://www.indigostar.com/. It's a commecial programm but has a 30 days trying period. With the version 5.03 the translation seems to happend but after I was not able to create any .cel file. The code line i tried directly in the data folder of celestia was : "explore solarsys.scc > essai.cel" . This create an empty essai.cel file.

Could this programm be a solution for windows people like me ?

Anyway thank you for the script DoS
Gordon

Guest

Post #14by Guest » 04.04.2004, 18:40

I have tried an exe converter perl2exe from here http://www.indigostar.com/. It's a commecial programm but has a 30 days trying period. With the version 5.03 the translation seems to happend but after I was not able to create any .cel file. The code line i tried directly in the data folder of celestia was : "explore solarsys.scc > essai.cel" . This create an empty essai.cel file.

Could this programm be a solution for windows people like me ?

Anyway thank you for the script DoS


perl is a quite old and still very popular open-source proejct. There _must_ be a free
interpreter.
Secondly, if you read the instruction in the explore script you'll see that it expects
ssc data on it's standard input and location ssc file as a first (and only) command line
parameter. So, you say something like:
explore solsys_locs.ssc < data.ssc > demo.cel

DoS

Gordon
Posts: 83
Joined: 17.04.2003
With us: 21 years 7 months
Location: Paris, France

Post #15by Gordon » 05.04.2004, 11:07

Hello DoS,

Ok, it worked with the following line "explore solarsys_locs.ssc <solarsys.ssc> essai.cel" . A 558ko .cel file in less than one seconde !!! That's great ! Thanks.

About a free compiler, it seems that there is one included in the perl distribution but that's to complex for me. :oops:

On the script side, the "size compare to earth" function is not accurate with my profile. When it displays "Earth size compare to Earth size" the square is smaller than the earth (which obviously shouldn't be !). My configuration : windowed mode / full screen window / res 1280*1084.

Image
Gordon

Guest

Post #16by Guest » 07.04.2004, 19:01

On the script side, the "size compare to earth" function is not accurate with my profile. When it displays "Earth size compare to Earth size" the square is smaller than the earth (which obviously shouldn't be !). My configuration : windowed mode / full screen window / res 1280*1084.


Ups, sorry about that. I forgot to say that the output .cel script is optimized for a 1024x768
display. Now you can dowload the new explore.pl script with tunable (look at the constants
at the top of the script) screen width.
The link is: http://student.fizika.org/~dsvilko/celestia

DoS

Gordon
Posts: 83
Joined: 17.04.2003
With us: 21 years 7 months
Location: Paris, France

Post #17by Gordon » 09.04.2004, 07:50

Thanks DoS, it works find now.

About the atmosphere feature, would it be possible to have a "sunrise" or "sunset" feature ? By this I mean that the script would land you on the surface and show you the sun falling (or rising) in 15 sec. for exemple ?
Gordon

Guest

Post #18by Guest » 13.04.2004, 12:00

Gordon wrote:Thanks DoS, it works find now.

About the atmosphere feature, would it be possible to have a "sunrise" or "sunset" feature ? By this I mean that the script would land you on the surface and show you the sun falling (or rising) in 15 sec. for exemple ?


Try playing with the duration and time .cel parameters in the explore.pl script (in the code section).

DoS


Return to “Scripting”