Checkin of sample scripts

ver1_5_1
Chris Laurel 2003-05-01 17:43:42 +00:00
parent b836291557
commit ad124da37c
4 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,8 @@
jd = celestia:gettime()
last = jd + 365
repeat
jd = jd + 1.0
celestia:settime(jd)
wait(0.05)
until jd >= last

View File

@ -0,0 +1,18 @@
function mark_spectraltype(x)
local obs = celestia:getobserver()
local nstars = celestia:getstarcount()
local i = 0
while i < nstars do
star = celestia:getstar(i)
first, last = string.find(star:spectraltype(), x, 1, true)
if first == 1 then
celestia:mark(star)
end
i = i + 1
end
end
spectral = "O"
celestia:flash("Marking all " .. spectral .. " stars.")
mark_spectraltype(spectral)

View File

@ -0,0 +1,9 @@
obs = celestia:getobserver()
while 1 do
nstars = celestia:getstarcount()
index = math.floor(nstars * math.random())
star = celestia:getstar(index)
celestia:select(star)
obs:goto(star, 10)
wait(10)
end

View File

@ -0,0 +1,23 @@
function goto(o, t)
local obs = celestia:getobserver()
obs:follow(o)
obs:goto(o, t)
while (obs:travelling()) do
wait(0)
end
end
function visit(o)
local i, v
celestia:select(o)
celestia:flash(o:type() .. " - " .. o:name())
goto(o, 3)
wait(0.5)
local children = celestia:getchildren(o)
for i, v in ipairs(children) do
visit(v)
end
end
sol = celestia:find("Sol")
visit(sol)