Stellarium
0.22.2
|
Since version 0.10.1, Stellarium includes a scripting feature based on the Qt Scripting Engine.
This makes it possible to write small programs within Stellarium to produce presentations, set up custom configurations, and to automate repetitive tasks. Prior to version 0.10.0, Stellarium used a different scripting engine called StratoScript.
The core scripting language is ECMAScript, giving users access to all basic ECMAScript language features such as flow control, variables string manipulation and so on. Interaction with Stellarium-specific features is done via a collection of objects which represent components of Stellarium itself. See Scripting API for more details.
Interation with Stellarium-specific functionality is done by calling the public slots of instances of a group of Stellarium's core classes.
Stellarium provides mechanism for splitting scripts on different files. Typical functions or list of variables can be stored in separate .inc file and used within script through include() command:
It is possible to open, edit run and save scripts using the script console window.
To toggle the script console, press F12. The script console also provides an output window in which script debugging output is visible.
The best source of examples is the scripts sub-directory of the main Stellarium source tree. This directory contains a sub-directory called tests which are not installed with Stellarium, but are nontheless useful sources of example code for various scripting features. (The directory can be browsed online. Script files end in .ssc
and .inc
. Download links are to the right.)
This script prints "Hello Universe" in the Script Console output window.
This script uses the LabelMgr module to display "Hello Universe" in white on the screen for 3 seconds.