Celestia/Celx Scripting/CELX Lua Methods/CEL command cancel
cancel
editcancel { }
Cancels goto and track commands, and resets the Coordinate System to universal, which means it also cancels follow, synchronous and other Coordinate System related commands. This command is much like pressing the [Esc] key when running Celestia in its interactive mode.
The command has no arguments.
CELX equivalent:
The CELX equivalent consists of a sequence of 3 steps:
- Get observer instance of the active view and stop any goto or center command currently in progress.
obs = celestia:getobserver() obs:cancelgoto()
- Stop tracking an object.
obs:track(nil)
- Create new frame and reset the coordinate system to universal.
frame = celestia:newframe("universal") obs:setframe(frame)
Summarized:
obs = celestia:getobserver() obs:cancelgoto() obs:track(nil) frame = celestia:newframe("universal") obs:setframe(frame)
Example:
The first part of this script selects the Earth, goes to it, and then performs other commands, maybe to change its view, speed up time, etc. The second section executes a cancel command, selects Mars, and then performs other commands on Mars:
CEL:
select { object "Sol/Earth" } goto { time 3 } wait ( duration 3 } # ... # <other commands doing other things> # ... cancel { } select { object "Sol/Mars" } goto { time 3 } wait { duration 3 } # ... # <other commands doing other things> # ...
CELX:
earth = celestia:find("Sol/Earth") obs = celestia:getobserver() obs:goto(earth, 3.0) wait(3.0) -- ... -- <other methods doing other things> -- ... obs:cancelgoto() obs:track(nil) frame = celestia:newframe("universal") obs:setframe(frame) mars = celestia:find("Sol/Mars") obs:goto(mars, 3.0) wait(3.0) -- ... -- <other methods doing other things> -- ...