Page 1 of 1

Celx getinfo( ) Table Key Problems

Posted: 12.06.2010, 22:55
by VikingTechJPL
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.

Re: Celx getinfo( ) Table Key Problems

Posted: 30.09.2010, 16:54
by Marco Klunder
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

Re: Celx getinfo( ) Table Key Problems

Posted: 15.10.2010, 22:58
by ajtribick
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)