New makeactiveview method for CELX scripting

All about writing scripts for Celestia in Lua and the .cel system
Topic author
Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

New makeactiveview method for CELX scripting

Post #1by Vincent » 17.09.2008, 13:19

Celestia 1.6 now includes a new observer:makeactiveview() method for celx scripting.

Example:

Code: Select all

targets = {}

targets[1] = celestia:find("Sol/Jupiter/Callisto")
targets[2] = celestia:find("Sol/Jupiter/Europa")
targets[3] = celestia:find("Sol/Jupiter/Ganymede")
targets[4] = celestia:find("Sol/Jupiter/Io")

DisplayActiveView = function(k)
   celestia:select(targets[k])
   obs = celestia:getobserver()
   celestia:print(" Active view: view #"..k.."\n Press G key...", 8)
   wait(8)
end

obs = celestia:getobserver()
obs:singleview()

obs:splitview("h", 0.5)
obs = celestia:getobservers()
obs[1]:splitview("v", 0.5)
obs[2]:splitview("v", 0.5)
wait(3)

observers = celestia:getobservers()

for k, obs in pairs(observers) do
   obs:makeactiveview()
   DisplayActiveView(k)
   wait(5)
end

obs:singleview()

All the new celx scripting features are listed on the Celestia wikibook:
http://en.wikibooks.org/wiki/Celestia/C ... ua_Methods
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Return to “Scripting”