Page 1 of 1

Preliminary Scripting FAQ

Posted: 02.09.2006, 12:16
by selden
This is a duplicate of Q/A #15 of the Preliminary User's FAQ. I've locked this thread, but please post Qs and As that you think should be added.

Q1:
I want to write some scripts for Celestia. How can I do it?


A1a:
Visit the Celestia Scripting Forum

A1b:
Read and contribute to the Celestia Scripting Guide, which is available on the Documentation Page of the Celestia MotherLode.


Briefly:
a) Celestia includes a very simple scripting language of its own which understands commands like "go here, look there, set flag, display text". These commands should go into a file with the filetype .CEL

A slightly out-of-date summary of .CEL commands is at http://www.shatters.net/celestia/docs/scripting.html. Also see http://www.lepp.cornell.edu/~seb/celestia/celestia_notes.html#4.0 for a list of more of the .CEL scripting commands, somewhat cryptically organized.

An example .CEL script is Celestia's own start.cel, which is on your computer in Celestia's main directory.

Another example is the script at http://www.shatters.net/~t00fri/images/start-pandemo.cel

b) Starting with Celestia v1.3.1, the Lua programming language is available for use in .CELX scripts. See http://www.lua.org/.

A few example Lua scripts for Celestia are available on SourceForge at http://celestia.cvs.sourceforge.net/celestia/celestia/scripts/

Documentation for Celestia's implementation of Lua can be found at http://www.h-schmidt.net/celestia/

A Lua manual is available at http://www.lua.org/docs.html

Some additional example scripts and brief documentation are available in the Celestia WikiBook at http://en.wikibooks.org/wiki/Celestia

Useful .CEL and .CELX scripts are available in Don G's Celestia Scripting Resources

c) You can use any language you want if it can pass commands to the operating system's command interpreter: it can run Celestia and tell it to run a .CEL Celestia script or .CELX Lua script.

When invoked from a command line, Celestia can be passed the name of a .CEL or .CELX script to run at startup:

Code: Select all

./celestia --url name-of-script.cel

When the command line includes the qualifier "--once", the command line will be passed to the running copy of Celestia instead of starting a new copy of the program. (note: two hyphens)

Code: Select all

./celestia --once --url name-of-script.celx


(As of Celestia v1.3.1, scripts may be in any folder. Previously they had to be in Celestia's "root" folder.)

[updated 2Sep06 to repair Web addresses]
[update 27Nov07 to include ref to DonG's pages]