Celestia/Celx Scripting/CELX Lua Methods/CEL command singleview

singleview

edit

singleview {}

Make the actual active view within a Multi view the only view.


Notes:

  1. Using this command only makes sense if there is at least one Muliti view left. This command has no effect on a Single view.


CELX equivalent:

Based on the observer:singleview() method.

  • Get observer instance of the active view instance within a Multi view and make it the only view.
obs = celestia:getobserver()
obs:singleview()

-- OR --

  • Get observer instances of all views and make the view with identifier <viewnumber> the only view.
observers = celestia:getobservers()
observers[<viewnumber>]:singleview()


Example:
Create a Muliview of 4 views and for each view goto different planets. After five seconds, make view 4 the only view.

CEL:

splitview { view 1 type "V" position 0.5 }
splitview { view 1 type "H" position 0.5 }
splitview { view 2 type "H" 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 }
setactiveview { view 3}
select { object "Mars" }
goto   { time 2.0 distance 15 }
setactiveview { view 4}
select { object "Jupiter" }
goto   { time 2.0 distance 15 }
wait { duration 5.0 }
singleview { view 4 }

CELX:

obs = celestia:getobserver()
obs:splitview("V", 0.5)
observers = celestia:getobservers()
observers[1]:splitview("H", 0.5)
observers[2]:splitview("H", 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())
observers[3]:makeactiveview()
mars = celestia:find("Sol/Mars")
celestia:select(mars)
observers[3]:gotodistance(mars, 15*mars:radius())
jupiter = celestia:find("Sol/Jupiter")
celestia:select(jupiter)
observers[4]:makeactiveview()
observers[4]:gotodistance(jupiter, 15*jupiter:radius())
wait(5.0)
observers[4]:singleview()


Back to CEL command index