A script to mark all pulsars
Posted: 27.07.2007, 17:28
Here's a celx code to mark all pulsars (based on some script from Vincent).
This is very handy for the pulsars database update (from ANTF) that I'm doing right now.
Here's a similar script to unmark the pulsars. I don''t know if this is the shortest script that can do the same. Maybe there's annother way. Vincent ?
Code: Select all
-- Title: Mark all pulsars
function mark_spectraltype(x)
local obs = celestia:getobserver()
local nstars = celestia:getstarcount()
local i = 0
-- while i < nstars do
-- star = celestia:getstar(i)
for star in celestia:stars() do
first, last = string.find(star:spectraltype(), x, 1, true)
if first == 1 then
star:mark("#8000ff", "plus", 5)
end
i = i + 1
end
end
spectral = "Q"
celestia:flash("Marking all " .. spectral .. " stars.")
mark_spectraltype(spectral)
This is very handy for the pulsars database update (from ANTF) that I'm doing right now.
Here's a similar script to unmark the pulsars. I don''t know if this is the shortest script that can do the same. Maybe there's annother way. Vincent ?
Code: Select all
-- Title: unmarks all the pulsars
function unmark_spectraltype(x)
local obs = celestia:getobserver()
local nstars = celestia:getstarcount()
local i = 0
-- while i < nstars do
-- star = celestia:getstar(i)
for star in celestia:stars() do
first, last = string.find(star:spectraltype(), x, 1, true)
if first == 1 then
star:unmark()
end
i = i + 1
end
end
spectral = "Q"
celestia:flash("unmarking all " .. spectral .. " stars.")
unmark_spectraltype(spectral)