I'm trying to get the albedo of the selected object in a script.
Code: Select all
KM_PER_LY = 9.46728E12
KM_PER_AU = 149600000
camera = celestia:getobserver()
planet = celestia:find("Mars") -- finds object named Mars
camera:center(planet,1)
celestia:select(planet)
cameraPosition = camera:getposition() -- gets position of observer
planetPosition = planet:getposition() -- gets position of Mars
distance = planetPosition:distanceto(cameraPosition) -- gets distance from position of Mars to that of observer
distAU = distance/KM_PER_AU
celestia:flash("Current distance to Mars is "..distAU.. " AU")
wait(2)
albedo = planet:getinfo(albedo)
radius = planet:radius()
planmag = -26.73 - (5 * (math.log10(((math.sqrt(albedo))*radius)/149600000)))
When I run this it returns the distance with no problem, but says that:
"in line 13, no arguments expected to function object:getinfo"
So how do I tell it to extract the albedo of the planet and use that in the planmag equation?
Also, is it possible to round off the numbers shown on the screen? Currently they're shown to way too many decimal places.
BTW, I think Harald's site would be even more useful than it is if he had some actual examples of how the commands are actually used in practise, instead of just a 'general case'.