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

< Celestia < Celx Scripting < CELX Lua Methods

cancel

cancel { }

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:

obs = celestia:getobserver()
obs:cancelgoto()
obs:track(nil)
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 it's 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>
-- ...

Back to CEL command index

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.