-- jovianmoons.celx -- -- Copyright (C) 2008, Chris Laurel, claurel@gmail.com -- -- Script to highlight orbits of the various groups of Jovian moons -- -- Moons without official IAU names are not included. Lists are -- based on information from a Wikipedia article on the moons of -- Jupiter: http://en.wikipedia.org/wiki/Moons_of_Jupiter function intro() local message = [[ Jovian Satellite Groups Use the number keys to toggle the orbits of various groups of Jovian satellites. 1: Inner satellites 2: Galilean satellites 3: Himalia group 4: Ananke group 5: Carme group 6: Pasiphae group ESC: End script Orbits are not shown for satellites without official IAU names or where the membership in a group is questionable. Press any key to continue... ]] celestia:print(message, 120, -1, 1, 7, -4) end -- Intro function from Harald Schmidt's timestepkeys script. intro_finished = false function end_intro() intro_finished = true celestia:print("", 0.1) celestia_keyboard_callback = keyhandler end celestia_keyboard_callback = end_intro inner = { "Sol/Jupiter/Metis", "Sol/Jupiter/Adrastea", "Sol/Jupiter/Amalthea", "Sol/Jupiter/Thebe" } galilean = { "Sol/Jupiter/Io", "Sol/Jupiter/Europa", "Sol/Jupiter/Ganymede", "Sol/Jupiter/Callisto" } himalia = { "Sol/Jupiter/Himalia", "Sol/Jupiter/Leda", "Sol/Jupiter/Lysithea", "Sol/Jupiter/Elara" } ananke = { "Sol/Jupiter/Ananke", "Sol/Jupiter/Praxidike", "Sol/Jupiter/Iocaste", "Sol/Jupiter/Harpalyke", "Sol/Jupiter/Thyone", "Sol/Jupiter/Euanthe", "Sol/Jupiter/Euporie" } carme = { "Sol/Jupiter/Carme", "Sol/Jupiter/Pasithee", "Sol/Jupiter/Chaldene", "Sol/Jupiter/Arche", "Sol/Jupiter/Isonoe", "Sol/Jupiter/Erinome", "Sol/Jupiter/Kale", "Sol/Jupiter/Aitne", "Sol/Jupiter/Taygete", "Sol/Jupiter/Kalyke", "Sol/Jupiter/Eukelade", "Sol/Jupiter/Kallichore" } pasiphae = { "Sol/Jupiter/Eurydome", "Sol/Jupiter/Pasiphae", "Sol/Jupiter/Hegemone", "Sol/Jupiter/Sponde", "Sol/Jupiter/Cyllene", "Sol/Jupiter/Megaclite", "Sol/Jupiter/Callirhoe", "Sol/Jupiter/Sinope", "Sol/Jupiter/Autonoe", "Sol/Jupiter/Aoede", "Sol/Jupiter/Kore" } function enable_orbits(t, r, g, b) for i, name in ipairs(t) do local moon = celestia:find(name) if moon then moon:setorbitvisibility("always") moon:setorbitcoloroverridden(true) moon:setorbitcolor(r, g, b) end end end function disable_orbits(t) for i, name in ipairs(t) do local moon = celestia:find(name) if moon then moon:setorbitvisibility("normal") moon:setorbitcoloroverridden(false) end end end function toggle_orbits(t, r, g, b) -- Test whether the orbit of the first satellite in the -- group has a color override and decide whether to -- enable or disable based on that. local name = t[1] local moon = celestia:find(name) if (moon:orbitcoloroverridden()) then disable_orbits(t) else enable_orbits(t, r, g, b) end end function keyhandler(input) local ch = string.sub(input, 1, 1) if (ch == "1") then celestia:flash("Inner satellites") toggle_orbits(inner, 1, 0.6, 0) return true elseif (ch == "2") then celestia:flash("Galilean satellites") toggle_orbits(galilean, 1, 1, 0) return true elseif (ch == "3") then celestia:flash("Himalia group") toggle_orbits(himalia, 0.2, 1, 0) return true elseif (ch == "4") then celestia:flash("Ananke group") toggle_orbits(ananke, 0.7, 1, 0.5) return true elseif (ch == "5") then celestia:flash("Carme group") toggle_orbits(carme, 0.5, 0.8, 1) return true elseif (ch == "6") then celestia:flash("Pasiphae group") toggle_orbits(pasiphae, 0.8, 0.5, 1) return true else return false end end function disable_all() disable_orbits(inner) disable_orbits(galilean) disable_orbits(himalia) disable_orbits(ananke) disable_orbits(carme) disable_orbits(pasiphae) end disable_all() celestia:setrenderflags({orbits = true}) celestia:setorbitflags({Moon = false}) intro() --celestia_keyboard_callback = keyhandler celestia:requestkeyboard(true) while true do wait(1) end disable_all()