Celx objects

All about writing scripts for Celestia in Lua and the .cel system
Topic author
jan stegehuis
Posts: 27
Joined: 13.12.2010
Age: 70
With us: 13 years 11 months
Location: Hoogmade, The Netherlands

Celx objects

Post #1by jan stegehuis » 17.03.2011, 19:28

On my celestia space I wrote a page on scripting with objects. Objects are a specific kind of script that is highly reusable. You just put the code in some library file and you can (re)use it's functionality whereever you want. As an example, the page creates a celx color class that adds a color type to celx allowing to specify colors in the more common notations:

  • digital 8-bit rgb : red = rgb(255, 255, 0) and
  • hexadecimal rgb : red = "#FFFF00" or red = "red";
to store colors for later (re)use and to convert between notations. Arithmetic rgb - Celestia's default notation - is also supported.

You don't need to read and understand the page; you can just download the script and demo files and use them. They are available for download at the bottom of the page

There is also an object version available of the menu script.


There are at least two more objects comming up: a datetime object and a list object.
I'll announce them in this post when they are done.


Jan
jan.stegehuis at google mail
win 7 hp 64bit, intel I5, 2.53 GHz, 4GB , ATI MR HD 5470
celestia 1.6.0

Not smoking still "sucks".

Avatar
Marco Klunder
Posts: 181
Joined: 20.02.2008
Age: 62
With us: 16 years 9 months
Location: The Netherlands

Re: Celx objects

Post #2by Marco Klunder » 15.04.2011, 16:34

Jan,

I was just checking out the working of your colordemo, but I run into this error:

colordemo.jpg

Marco
Marco Klunder
email: marco.klunder@xs4all.nl
Windows10 PD 3.0 GHz, 2 GB of RAM, Nvidia GeForce 6700 XL
Celestia161 / SVN + Lua Edu Tools v1.2 Beta9, Celestia160-ED and Celestia1621

Topic author
jan stegehuis
Posts: 27
Joined: 13.12.2010
Age: 70
With us: 13 years 11 months
Location: Hoogmade, The Netherlands

Re: Celx objects

Post #3by jan stegehuis » 17.04.2011, 13:00

Thanks Marco,

Thought I could do this - nesting comment blocks - but I must have been mixing things up. :?
Changed color.celx so things should be running correctly now as version 1.1 on the objects page ( https://sites.google.com/site/jansceles ... /4-objects )

Kind regards
Jan
jan.stegehuis at google mail
win 7 hp 64bit, intel I5, 2.53 GHz, 4GB , ATI MR HD 5470
celestia 1.6.0

Not smoking still "sucks".


Return to “Scripting”