Celx getinfo( ) Table Key Problems

All about writing scripts for Celestia in Lua and the .cel system
Topic author
VikingTechJPL
Posts: 105
Joined: 04.03.2010
With us: 14 years 6 months

Celx getinfo( ) Table Key Problems

Post #1by VikingTechJPL » 12.06.2010, 22:55

Greetings CELX Scripters,

Anyone trying to use getinfo( ) in a CELX script should be aware of the following problems. According to the CELX Manual:

For a body (e.g. a planet) the table may include these keys
- type
- name
- mass
- oblateness
- albedo
- infoURL
- radius
- lifespanStart
- lifespanEnd
- parent
- hasRings
- rotationPeriod
- rotationOffset
- rotationEpoch
- rotationObliquity
- rotationAscendingNode
- rotationPrecessionRate
- orbitPeriod
- atmosphereHeight
- atmosphereCloudHeight
- atmosphereCloudSpeed

However,
- mass key doesn't work, always returns 0
- infoURL key doesn't work, returns nothing (NOT 0)
- parent (may be a body or a star) key doesn't work, crashes 1.4.1, Fatal Error in 1.6.0
- hasRings key doesn't work, crashes 1.4.1, Fatal Error in 1.6.0
- rotationOffset causes Fatal Error in 1.6.0
- rotationEpoch causes Fatal Error in 1.6.0
- rotationObliquity causes Fatal Error in 1.6.0
- rotationAscendingNode causes Fatal Error in 1.6.0
- rotationPrecessionRate causes Fatal Error in 1.6.0

Anyone wanting to test this on his or her machine can use the following short script:

Code: Select all

-- FIND A PLANET'S OR MOON'S MASS

--  ------------------------------------------------
--  FUNCTIONS

function celestia_cleanup_callback() 
        -- empty function
end

function FindKeyValue( )       
        Selection  = celestia : getselection ( )
        SelectionTable = Selection : getinfo ( )           
        if celestia:getselection ( ) : name ( )  ~= "?"  and
                ( SelectionTable.type == "planet" or  SelectionTable.type == "moon" )  then
               
                SelectionKeyValue = SelectionTable.mass
                             
                ValueString = string.format("  Your Selection's . . . is:  %s", SelectionKeyValue )   
                celestia:print(ValueString)
        else
                celestia:print("  Please select a Planet or Moon:")
        end               
end
--  ---------------------
--  START PROGRAM

Exit = false

repeat
        wait(0)
        FindKeyValue( )
until Exit
 


To check the other table keys, you just need to substitute each one's name for .mass

If anyone gets any different behaviors, please post them.

Many thanks.
1.6.1, Dell Studio XPS, AMD 2.7 GHz, 8 GB RAM, Win 7 64-bit, ATI Radeon HD 5670
1.6.0, Dell Inspiron 1720, Intel Core Duo 2 Ghz, 3 GB RAM, Win Vista, NVIDIA GeForce 8600M G/GT
1.4.1, Dell Dimension 4700, Pent-4 2.8 GHz, 512 MB RAM, Win XP SP2, Radeon X300

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

Re: Celx getinfo( ) Table Key Problems

Post #2by Marco Klunder » 30.09.2010, 16:54

VikingTechJPL wrote:According to the CELX Manual:

Hello VikingTechJPL,

Although a little late as an answer to this thread, there are indeed problems when using the mentioned keys.
As a result, the WIKI CELX manual is adjusted on this point now (I hope temporarily, until the working of them is correct in a new Celestia release).

Thanks for your feedback.

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

ajtribick
Developer
Posts: 1855
Joined: 11.08.2003
With us: 21 years 1 month

Re: Celx getinfo( ) Table Key Problems

Post #3by ajtribick » 15.10.2010, 22:58

Regarding the issue with the Mass key always returning zero, have you tried this on the extrasolar planets? The solar system planets do not have masses defined in the .ssc file.

(I'd test this myself but the machine I'm using right now is not capable of running Celestia)


Return to “Scripting”