Celestia/Celx Scripting/CELX Lua Methods/CEL command setactiveview
Appearance
setactiveview
[edit | edit source]setactiveview { view <viewnumber> }
Make the view with identifier <viewnumber> the actual active view within a Multi view.
Notes:
- Using this command only makes sense if there is at least one Muliti view left. This command has no effect on a Single view.
Arguments:
- view <viewnumber>
- A number, identifying the view on the screen to be the actual active view. Default is 1.
Must be a valid identifier, regarding the number of views on the screen, otherwise no change of active view will be performed.
CELX equivalent:
Based on the observer:makeactiveview() method.
- Get observer instances of all views and make the view with identifier <viewnumber> the actual active view.
observers = celestia:getobservers() observers[<viewnumber>]:makeactiveview()
Example:
Create a Muliview of 2 views, change active view to goto different planets and after 5 seconds delete view 1.
CEL:
splitview { view 1 type "V" position 0.5 }
setactiveview { view 1}
select { object "Mercury" }
goto { time 2.0 distance 15 }
setactiveview { view 2}
select { object "Venus" }
goto { time 2.0 distance 15 }
wait { duration 5.0 }
deleteview { view 1 }
CELX:
obs = celestia:getobserver()
obs:splitview("V", 0.5)
observers = celestia:getobservers()
observers[1]:makeactiveview()
mercury = celestia:find("Sol/Mercury")
celestia:select(mercury)
observers[1]:gotodistance(mercury, 15*mercury:radius())
observers[2]:makeactiveview()
venus = celestia:find("Sol/Venus")
celestia:select(venus)
observers[2]:gotodistance(venus, 15*venus:radius())
wait(5.0)
observers[1]:deleteview()