SCENARIO SCRIPTS

This page describes the new functionality introduced in the upcoming SpaceEngine 0.990, which has not been released yet.

This manual describes how to make scenario scripts in SpaceEngine. Before continuing, it is recommended to read this manual: Introduction

SpaceEngine console and *.se files

SpaceEngine 0.990 introduced a new type of file – *.se. These are scenario script files. They contains code which can be executed by SpaceEngine. A great example of what scenarios are capable of are Tutorials, introduced in 0.990. The default location for *.se files is data/scripts/ or addons/*/scripts/. You can run an *.se file from SpaceEngine by opening the console ([~] key by default) and typing this command:

Code
run filename

If the file filename.se exists in the mentioned folders, it will be executed. Another way to run *.se files is by passing them into SpaceEngine’s executable through a command line argument. The best way to do that is to associate the *.se extension with SpaceEngine.exe in your system. In that case double-clicking on the file will launch SpaceEngine and order it to execute the scenario script. If SpaceEngine is already running, this running instance will execute the script.

All commands could be executed in the ‘direct mode’ by typing them in the console, or executed from a *.se script file. Commands and most of their parameters are not case-sensitive, but string constants such as names of GUI widgets and names of triggers are case-sensitive.

Some commands can have (or even must have) additional parameters, provided in the curly braces block (i.e. those commands are actually tags). Example:

Code
Goto
{

Time 5.5
Dist 25000

}

Additional parameters could be typed in a single row:

Code
Goto { Time 5.5 Dist 25000 }

Using the single-row style sometimes makes the script code more compact and easy to read and understand.

All commands are split into groups according to their functions. Unroll the blocks below to read details.

SCRIPT CONTROL COMMANDS

Run

Runs a *.se script. It is possible to run one script from another, up to 16 nested calls are allowed. This is useful for executing a common set of commands, or to add a camera spline path from another script file (see the Camera spline path chapter for details). Syntax:
Run filename – executes the filename.se script file located in the data/scripts/ or addons/*/scripts/ folder.
Run “path/filename.sc” – executes the script file located at the provided path. Path is relative to SpaceEngine’s folder.

Break

Interrupts the currently executed script. If there was multiple scripts running, they will all be interrupted. Used primarily in direct mode (from the console) to break the script, but could be called from the *.se file. Syntax:
Break

Wait

Delays script execution by specified time in seconds. Syntax:
Wait 3.5 – delays script by 3.5 seconds.
This is one of the most useful command in SE scripts. You will use it after many commands, which require delays before the next command. For example, when you call the Goto command with parameter Time 10 (duration of the flight – 10 seconds), you probably want to follow it by Wait 10 to delay the script execution until the Goto command completes.

CheckVersion

Checks if the current version of SpaceEngine corresponding the version number provided in the command. If not, the following error message will be displayed to the user: “This script was designed for a different version of SpaceEngine. It cannot be run in the current version, sorry”. Syntax:
CheckVersion 990 – for SE version 0.990

if, elif, else, endif

This is the conditional operator statement. Syntax:
if { Variable == 1.0 }

if_commands

elif { Variable >= 2.0 }

elif_commands

else

else_commands

endif
The Variable is a name of SpaceEngine variable (see Variables chapter for details). The == is a comparison operator, possible operators are:
== (equal)
!= (not equal)
< (less)
> (greater)
<= (not greater)
>= (not less)
The value to the right of the operator is numerical for the integer, float and double variables, or 0/1 or true/false for boolean variables (see Variables chapter for details).
If the first condition (after if) is satisfied, then all the if_commands will be executed; after that control will be given to the first command after endif.
If the first condition is not satisfied, then control will be given to the first elif, if present, or to the else, if present, otherwise to the first command after endif. The elif statement works like if: if condition is satisfied, then all the elif_commands will be executed; after that control will be given to the first command after endif. Otherwise control will be given to the next elif or else, if they are present, otherwise – to the first command after endif. So you may use multiple elif statements. They can have conditions for other variables than if, statements are fully independent.
If the else statement is present and neither of the if and/or elif conditions were satisfied, all the else_commands will be executed, and after that control will be given to the first command after endif.
Curly braces for the conditions and the endif are mandatory, otherwise the “Syntax error” message will be shown. The elif and else statements are optional.
Important: nested if statement is not yet supported, i.e. you cannot do something like this:
if { Var1 == 1 } if { Var2 == 0 } command endif endif.
The error message “Nested IF statement is not supported” will be shown in this case.

Loop, EndLoop

This is a simple loop statement. Syntax:
Loop

commands

EndLoop
This repeats all commands enclosed between the Loop and EndLoop infinitely. Use Wait command there to delay execution.

CAMERA CONTROL COMMANDS

FOV

Sets field-of-view in degrees. Syntax:
FOV 90

Select

Selects a space object, ship, waypoint or spline path. Equivalent of a mouse click on the object, selecting it using search tool, etc. If the command succeeds, the selection pointer will be switched to the selected object. If the command fails, an error message will be shown in the console, and further execution of the scenario could be wrong. Syntax:
Select Earth – selects a space object by its name. Quotes can be skipped if there are no spaces in object’s name.
Select “RS 8474-2738-5-27954-210 1” – selects a space object by its name. Use quotes if there are spaces in the object’s name.
Select “Pandora|Sol” – selects a space object by its name and its parent name. Useful to solve name conflicts (for example, there is a Pandora moon of Saturn and an asteroid (55) Pandora orbiting the Sun).
Select “Waypoint 1” – selects a previously defined waypoint (see Waypoint).
Select “Path 1” – selects a previously defined spline path (see SplinePath).

Unselect

Removes any selection. The selection pointer will disappear. Syntax:
Unselect

Goto

Moves the camera to the selection. If there is no object selected, an error message will be shown in the console, and further execution of the scenario could be wrong. Syntax:
Goto – starts a flight with default parameters.
Goto { … } – starts a flight with custom parameters provided below:
{

Time 15.0 – duration of the flight in seconds; default is 2.
Dist 0.001 – stop point distance from the target in pc; no default.
DistKm 12500.0 – stop point distance from the target in km; no default.
DistRad 2.5 – stop point distance from the target in multiples of the target’s radii; default depends of object type, 2 for planets.
HeightKm 150.0 – stop point height from the target in km; no default.
Lon 86.4 – stop point longitude in degrees; no default.
Lat 13.5 – stop point latitude in degrees; no default.
Up ( 0.871, 0.124, -0.355) – stop point up vector; no default.
Yaw 60.3 – stop point yaw Euler angle in degrees; no default.
Pitch 21.6 – stop point Pitch angle in degrees; no default.
Roll 35.5 – stop point Roll angle in degrees; no default.

}
If Lon and/or Lat are provided, the end point binding mode will be “SyncRot”.
If no stop-point rotation-parameters were provided, the camera will end up rotated towards the center of the selected object.
If selection is a spline path, camera will go to its first knot point position and change its orientation to the first knot point orientation.
If you want to instantly “teleport” to the selection, use Time 0.
If you want to end the flight with the camera looking straight at the object, don’t specify any orientation parameters, or use Yaw 0 Pitch -90 Roll 0.
Important: the next script command will be executed immediately after this one. You must follow this command with the Wait command, with wait time equal to those in the Time parameter.

Center

Starts a turn toward the selection. If there is no object selected, an error message will shown in the console, and further execution of the scenario could be wrong. Syntax:
Center – starts a turn with default parameters.
Center { … } – starts a turn with custom parameters provided below:
{

Time 15.0 – duration of the turn in seconds; default is 2.

}
Important: the next script command will be executed immediately after this one. You must follow this command with the Wait command, with wait time equal to those in the Time parameter.

Horizon

Starts a turn toward the selection’s horizon. If were no object selected, an error message will shown in the console, and further execution of the scenario could be wrong. Syntax:
Horizon – starts a turn with default parameters.
Horizon { … } – starts a turn with custom parameters provided below:
{

Time 15.0 – duration of the turn in seconds; default is 2.

}
Important: the next script command will be executed immediately after this one. You must follow this command with the Wait command , with wait time equal to those in the Time parameter.

GotoLocation

Immediately moves (teleports) the camera to the specified location. Depending on the complexity of the location scene, loading may take a while. You may use FadeOut/FadeIn combined with WaitTrigger “LoadingComplete” to hide the loading process. If the current SpaceEngine version differs from the version number specified in the location code, a warning message will be shown to the user. of Syntax:
GotoLocation “Volcano under rings” – go to a location from the Locations browser (F6 menu).
GotoLocation “Location name” { … } – go to a location, whose code is defined directly in the scenario script in the curly braces block. Always use this method if the location is not one of the default SE locations, otherwise your scenario will not work for other users. To generate the code, add a location in the Location browser, then press “Share” -> “Copy script code to clipboard”, and paste the location code from the clipboard to the scenario script. Then change Place to GotoLocation
Note: the location saves the current stereobase (sense of a scale in 3D/VR modes). You may use this fact to setup a custom stereobase when starting a scenario. Another way to setup the stereobase is using the Stereobase variable (the command Set Stereobase XXXX, see the Variables chapter for details).

GotoURL

Similar to GotoLocation, but uses a location URL instead of code. If the current SpaceEngine version differs from the version number specified in the URL, a warning message will be shown to the user. Syntax:
GotoLocation “se://v=981&m=1&n=%CB%F3%ED%E0%20%C3%…” – go to a specified location URL. Use this as a more compact alternative of the GotoLocation. To generate the URL, add a location in the Location browser, then press “Share” -> “Copy URL to clipboard”, and paste the location URL from the clipboard to the scenario script. Enclose it with quotes and add GotoURL before it.

Follow

Changes camera binding mode to “Follow”: the camera moves together with the selected object’s center, i.e. ignoring its rotation. If a new object is selected, the currently followed object changes to that object, otherwise only the binding mode changes. Syntax:
Follow

SyncRot

Changes camera binding mode to “SyncRot”: the camera moves together with the selected object’s surface, i.e. keeps itself in rest relative to selection’s rotating surface. If a new object is selected, the currently followed object changes to that object, otherwise only binding mode changes. Syntax:
SyncRot

Free

Changes camera binding mode to “Free”: no binding to any object, camera stays at rest in space. The currently followed object clears. Syntax:
Free

Track

Enables tracking the selected object: camera rotates so that the tracking object stays in the center of the screen. Changing the selected object will not affect tracking. Syntax:
Track

Untrack

Disables tracking mode. Syntax:
Untrack

MoveMode

Changes camera motion mode (free/spacecraft/aircraft). Syntax:
MoveMode 2
Possible values:
1 – free mode (no inertia, flight direction follows the orientation);
2 – spacecraft mode (motion and rotation inertia, flight direction is independent of orientation);
3 – aircraft mode (motion and rotation inertia, flight direction follows the orientation).

Speed

Sets assigned camera speed in parsecs per second. Syntax:
Speed 2.5 – set a speed of 2.5 pc/s in the Spectator motion mode, otherwise acceleration of 0.25 pc/s2 will be set (in modes with inertia – Spacecraft and Aircraft).

SpeedKm

Sets assigned camera speed in kilometers per second. Syntax:
SpeedKm 123.4 – set a speed of 123.4 km/s in the Spectator motion mode, otherwise acceleration of 0.01234 km/s2 will be set (in modes with inertia – Spacecraft and Aircraft).

Fly

Starts camera moving in a view direction. Syntax:
Move – starts moving with default parameters.
Move { … } – starts moving with custom parameters provided below:
{

Axis (0, 0.707, 0.707) – motion direction vector, relative to the current camera orientation; default is (0, 0, 1) – flying forward.
Speed 5.5 – motion speed in parsecs per second; no default.
SpeedKm 17.6 – motion speed in kilometers per second; default is 100.
FadeTime 1.5 – smooth start duration in seconds; default is 2.
Func “Cubic” – smooth start function; default is “Linear”, possible values: “Linear”, “Quadric”, “Cubic”, “Sin”.

}
Important: the next script command will be executed immediately after this one. You must follow this command with the Wait command, with some wait time to see the motion effect.

StopFly

Smoothly stops camera motion in the motion modes that have inertia, or cancels out the Move command. Syntax:
StopFly
StopFly { … } – starts moving with custom parameters provided below:
{

FadeTime 1.5 – smooth stop duration in seconds; default is 2.
Func “Cubic” – smooth stop function; default is “Linear”, possible values: “Linear”, “Quadric”, “Cubic”, “Sin”.

}

Turn

Starts turning (rotating) camera around its own axes. Syntax:
Turn – starts turning with default parameters.
Turn { … } – starts turning with custom parameters provided below:
{

AngularSpeed 45.0 – turn rate in degrees per second; default is 10.
Axis (0, 0.707, 0.707) – axis around which turn occurs; default is (0, 1, 0) – vertical axis of the camera.
FadeTime 1.5 – smooth start duration in seconds; default is 2.
Func “Cubic” – smooth start function; default is “Linear”, possible values: “Linear”, “Quadric”, “Cubic”, “Sin”.

}
Important: the next script command will be executed immediately after this one. You must follow this command with the Wait command, with some wait time to see the motion effect.

StopTurn

Cancels out the Turn command. Syntax:
StopTurn – stops orbiting with default parameters.
StopTurn{ … } – starts orbiting with custom parameters provided below:
{

FadeTime 1.5 – smooth stop duration in seconds; default is 2.
Func “Cubic” – smooth stop function; default is “Linear”, possible values: “Linear”, “Quadric”, “Cubic”, “Sin”.

}

Orbit

Starts circular motion (‘orbiting’) around selected object. Syntax:
Orbit – starts orbiting with default parameters.
Orbit { … } – starts orbiting with custom parameters provided below:
{

AngularSpeed 45.0 – orbiting rate in degrees per second; default is 10.
Axis (0, 0.707, 0.707) – axis around which orbiting occurs; default is (0, 1, 0) – polar axis of an object.
FadeTime 1.5 – smooth start duration in seconds; default is 2.
Func “Cubic” – smooth start function; default is “Linear”, possible values: “Linear”, “Quadric”, “Cubic”, “Sin”.

}
During orbiting, camera orientation changes in that way so the object remains static on the screen. Use the Goto/GotoLocation/GotoURL commands before this one to set a proper initial orientation.
Important: the next script command will be executed immediately after this one. You must follow this command with the Wait command, with some wait time to see the motion effect.

StopOrbit

Cancels out the Orbit command. Syntax:
StopOrbit – stops orbiting with default parameters.
StopOrbit { … } – starts orbiting with custom parameters provided below:
{

FadeTime 1.5 – smooth stop duration in seconds; default is 2.
Func “Cubic” – smooth stop function; default is “Linear”, possible values: “Linear”, “Quadric”, “Cubic”, “Sin”.

}

WAYPOINTS

Waypoints are a special ‘virtual’ objects that can be displayed to the user and used in the script. Waypoints can be selected with the Select command using its name, then the Goto or Center command can be called to move/rotate the camera to that waypoint. They also can be used with triggers to detect certain events, such as a reaching a specific point in space, by using the WaitTrigger “Object|Approach” command. See the Triggers chapter for details. Waypoint’s name can contain abbreviations and BB codes, including the [LOC] code to make translations to other languages. The text label near the waypoint can be controlled independently from the waypoint itself (i.e. can be hidden, faded out, changed in color etc).

Waypoint script commands

Waypoint

Adds (defines) a new waypoint, or modifies an existing one. If a waypoint with such name has been defined in the script previously, it will be updated with the provided data, otherwise a new waypoint will be added. Syntax:
Waypoint “Name” { … } – adds/modifies a waypoint with name “Name”, with parameters provided below:
{

Parent “Pandora|Sol” – name of a parent object, i.e. object to which this waypoint is bound. It has the same format as in the Select command (“Parent|Object”).
Visible false – is the waypoint visible to the user or not. Use false to hide previously defined waypoint, and true to show it again. Default is true.
Label true – is the waypoint’s label visible (text, equal to its Name). Default is true.
Radius 0.25 – radius in parsecs.
RadiusKm 500.0 – radius in kilometers; default is 1.
Roll 45.0 – rotation angle of the waypoint model in degrees; default is 0.
Color (1.0, 0.8, 0.0, 0.6) – color in (R, G, B, A) format (A is opacity); default is white – (1, 1, 1, 1).
ColorEmpty (0.2, 0.2, 0.0, 0.6) – color in the empty (non-filled) animation state in (R, G, B, A) format (A is opacity); default is transparent black – (0, 0, 0, 0).
LabelColor (1.0, 0.8, 0.0, 0.6) – color of the text label in (R, G, B, A) format (A is opacity); default is equal to Color, if specified.
FadeRange (10, 20, 900, 1000) – distance range, at which the waypoint is visible, in parsecs. First two values in vector are distance range of smooth transition form invisible to visible state, last two values are distance range of back transition from visible to invisible. Default values are (1e38, 0, 0, 1e38) effectively disables transitions (makes waypoint visible at all distances).
FadeRangeKm (10, 20, 900, 1000) – the same as FadeRange, in kilometers.
LabelFadeRange (10, 20, 900, 1000) – the same as FadeRange, in parsecs, for waypoint’s label.
LabelFadeRangeKm (10, 20, 900, 1000) – the same as LabelFadeRange, in kilometers, for waypoint’s label.
LineWidth 10 – width of the line in pixels; default is 2.
Shape “Diamond” – shape of the waypoint which will be displayed to the user. Allowed shapes are: “Circle”, “Triangle”, “Square”, “Diamond”, “Hexagon”, “Billboard”, “Sphere”, “WireSphere”. The latter two are 3-dimensional. Default is “Circle”.
StaticPosXYZ (1.0, 0.5, 0.7) – static Cartesian coordinates (x, y, z) relative to the parent object in parsecs.
StaticPosXYZKm (110.5, 57.3, 16.7) – static Cartesian coordinates (x, y, z) relative to the parent object in kilometers.
StaticPosPolar (32.9, 60.3, 1.65) – static polar coordinates (latitude, longitude, distance) relative to the parent object; lat/lon in degrees, distance in parsecs.
StaticPosPolarKm (32.9, 60.3, 7500.0) – static polar coordinates (latitude, longitude, distance) relative to the parent object; lat/lon in degrees, distance in kilometers.
FixedPosXYZ (1.0, 0.5, 0.7) – fixed Cartesian coordinates (x, y, z) relative to the parent object in parsecs.
FixedPosXYZKm (110.5, 57.3, 16.7) – fixed Cartesian coordinates (x, y, z) relative to the parent object in kilometers.
FixedPosPolar (32.9, 60.3, 1.65) – fixed polar coordinates (latitude, longitude, distance) relative to the parent object; lat/lon in degrees, distance in parsecs.
FixedPosPolarKm (32.9, 60.3, 7500.0) – fixed polar coordinates (latitude, longitude, distance) relative to the parent object; lat/lon in degrees, distance in kilometers.
Texture “data/textures/common/logo0990.*” – path to the image file for the billboard waypoint.
TexCoord (0.5, 0.5, 0.2, 0.5) – texture coordinates in relative units: (x offset, y offset, width, height). Value of 0.5 means 50% of the texture dimension (width or height), 0.25 means 25% and so on. The specified area of the texture will be displayed. Default is (0, 0, 1, 1) – display the whole texture.
TexCoordPix (0.5, 0.5, 0.2, 0.5) – texture coordinates in pixels: (x offset, y offset, width, height). The specified area of the texture will be displayed.

}
Static coordinates are equivalent to the ‘Follow’ mode, while fixed coordinates are equivalent to the ‘SyncRot’ mode. In the first case, waypoint is bound to the parent object’s center, i.e. moves together with the object, ignoring its rotation. In the second case, it moves and rotates together with the object, i.e. remains fixed relative to the object’s surface.
Waypoint with shape “Circle” supports filling-like animation, when used with the WaitTrigger “Object|See” (see Triggers for details). It starts as the circle of the color ColorEmpty, and while user looking on it during the Delay seconds (this is the trigger’s parameter), it filling up clockwise with the color Color.
Waypoint with shape “Billboard” is alpha-blended textured billboard (a rectangle always oriented to the user). Parameter Texture specifies the image used to texture the billboard. If not specified or image file does not exist, the default ‘No image’ texture will be used. Parameters TexCoord or TexCoordPix specifies which part of the image to use. If not specified, the whole image will be displayed. Parameter Color specifies color modulation of the texture and its alpha (opacity) channel.

DeleteWaypoint

Deletes a previously added waypoint. Syntax:
DeleteWaypoint “Name”

ClearWaypoints

Deletes all waypoints. Syntax:
ClearWaypoints

CAMERA SPLINE PATHS

The camera spline path is a powerful tool to make custom flybys. Using the Camera path editor, you can ‘record’ your manual flight, and save it to a script file for a further use. This includes:

– replaying a recorded path in the Camera path editor;
– replaying a recorded path while simultaneously capturing video in a high quality rendering mode (offline video rendering);
– replaying a recorded path in a script using the PlaySplinePath command.

Spline is a mathematical function which is used for a smooth interpolation of some value (in SpaceEngine, camera coordinates and orientation) between a discrete number of data points, called knots. In other words, you may have, say, only 50 knots – data points which represents fixed position and orientation in space – and perform a smooth movement between them. This is a very compact and convenient way to record a flights.

Spline path script commands

SplinePath

Adds (defines) a camera spline path. Syntax:
SplinePath “SplineName” { … } – adds a spline path with a name “SplineName” with parameters provided below:
{

Body “PI Hya 7” – name of a reference object.
Parent “PI Hya” – name of a reference object’s parent.
SyncRot true – spline path binding mode: SyncRot if true, Follow if false.
Duration 52.0 – replay duration in seconds.
PosSpline “Catmull-Rom” – a type of position interpolation spline.
RotSpline “B-spline” – a type of orientation interpolation spline.
FollowQuat (1, 0, 0, 0) – initial camera orientation in the Follow binding mode.
SplineData { … } – array of knot points: multiple lines in the form of (time, pos.x, pos.y, pos.z, rot.w, rot.x, rot.y, rot.z), enclosed in a curly braces.

}
You may type all the data points into the SplineData { } tag manually, but using the Camera path editor is a more convenient way.

DeleteSplinePath

Deletes a camera spline path. Syntax:
DeleteSplinePath “SplineName”

ClearSplinePaths

Deletes all camera spline paths. Syntax:
ClearSplinePaths

PlaySplinePath

Starts flight through the spline path. Syntax:
PlaySplinePath “SplineName” – starts flight through the spline path “SplineName” with default parameters.
PlaySplinePath “SplineName” { … } – starts flight through the spline path “SplineName” with custom parameters provided below:
{

Time 30.0 – overrides the flight duration; default value is a spline duration described in the SplinePath command.

}
Seeing as the camera is being teleported to the first spline’s knot point and starts smooth moving through other knot points, it is a good idea to smoothly move the camera to the first knot point before calling this command. To do this, use the Goto “SplineName” command.
Important: the next script command will be executed immediately after this one. You must follow this command with the Wait, with a wait time equal to the Time parameter of the spline path duration, to delay the execution of the next commands until the spline flight completes. Other commands may be executed during the spline flight, except commands which change the camera position/orientation.

Using the Camera path editor

Open the Camera path editor in the Main menu > Editor menu. Configure the path parameters: its name, types of splines, how often to add a knot point. Start recording a path by pressing the [Record] (red round) button; when done, stop recording by pressing the [Stop] (white square) button. You may visualize the recorded path by ticking the ‘Display path curve’, and replay it by pressing the [Play] (white triangle) button. It is possible to add knot points manually while recording .

In the current version of SpaceEngine, it is impossible to edit the recorded spline, but this functionality will be added in future. You may only change the spline type and replay duration.

Once completed, save the file to the desired directory, for example addons/my_addon/scripts/path.ssp. The saved file is a usual SE scenario script file, which contains only one command SplinePath with some parameters and data points. It has the *.ssp extension just to distinguish it from a usual script files *.se in the open/save file dialog. You may use this file further, either to it load back into the editor, or to replay the recorded path from another script. There are two ways to achieve this:

– simply open the saved file, copy its content and paste into your script;
– call the script file with a recorded path from your script using the Run command:

Code
Run “path.ssp”

After defining the spline path in the script by one of these methods, you may replay it by the PlaySplinePath command:

Code
PlaySplinePath “PathName”

Here “PathName” is the same name used in the SplinePath command (either in the *.ssp file or directly in your script). It is a good idea to smoothly move camera to the first spline’s knot point before starting the replay. Use the Goto “PathName” to do this.

The spline path is bound to some space object. By default, it is the same object that is bound to the camera when you started recording the path. It has two binding modes: Follow and SyncRot. In the Follow mode, spline moves together with the object, ignoring its rotation. In the SyncRot, it moves and rotates together with the object, i.e. remains fixed relative to the object’s surface. The first is useful for a deep-space path recording, while the second is best for flights above the planetary terrain. You may switch modes by the ‘SyncRot’ checkbox in the Camera path editor.

You may set any custom date/time and speed up the time flow during path replay (either manually or by the time control script commands), and this will not affect the motion of the camera relative to the object or its surface. This is useful for making a ‘timelapse’ effect.

Usage of the Camera path editor and recording a video with it is summarized in this video. Note that it may be out of date; the tools shown in your version of SpaceEngine are likely much more advanced.

TIME CONTROL COMMANDS

StopTime

Pauses timeflow. Syntax:
StopTime

StartTime

Resumes timeflow: sets time rate to this value it has before pausing by the StopTime command or by user actions. Syntax:
StartTime

TimeSale

Sets a time rate (speed). Syntax:
TimeSale 100.0 – sets a time rate of 100x times faster than real time.
Use negative values to reverse direction of timeflow. Use value of 1 to set the real time rate. Don’t use a value of zero to stop the time flow, use the StopTime command instead.

Date, Time

Sets specified date and time. Both commands are equal. Syntax:
Date “2017.02.08 17:29:34.65” – sets date and time with millisecond precision. Format is “YYYY.MM.DD hh:mm:ss.sss”. You may omit the smaller values (i.e. limit precision up to seconds, minutes, days and months); in that case omitted terms will be considered as zero (hours, minutes and seconds) or one (months, days). Example:
Date “2017.02.08 17:29” – sets 17:29:00 on 08 February 2017.
Date “2017.02.08” – sets 00:00:00 on 08 February 2017.
Date “2017.02” – sets 00:00:00 on 01 February 2017.
Date “2017” – sets 00:00:00 on 01 January 2017.
Date “current” – sets the current date according to the system clock.

TRIGGERS

Triggers are events which can occur while SpaceEngine is running: user inputs, variable changes, position/time matches, etc.

WaitTrigger

Delays script execution until some event happens. Syntax:
WaitTrigger “TriggerName” – wait until event “TriggerName” happens, some default parameters could be used.
WaitTrigger “TriggerName” { … } – wait until event “TriggerName” happens, with parameters provided below:
{

Object “Sol|Earth” – name of a SpaceEngine object (planet, galaxy etc) or a waypoint.
Type “Planet|Desert” – type of a SpaceEngine object. See the table below for details.
Dialog “Universe map” – name of a dialog window, toolbar or any GUI widget. See SetWidgetStyle for details.
Mode “AND” – modifies default behaviour or interval checking for some triggers. Possible values: “OR”, “AND”, “Crossed”, “Earlier”, “Later”, “InRange”, “OutRange”. Defaults are “OR” and “Crossed”.
Time “2017.02.09 22:05:15” – date/time value, format is identical to the Date command.
TimeRange (“2017.02.09 22:05:00”, “2017.02.09 22:06:00”) – date/time range, array of two strings representing two dates.
MaxWaitTime 5.5 – maximum wait time in seconds.
Value 5.5 – value of a variable.
ActivationDelay 5.5 – delay before trigger activation in seconds.
AnimateObject “Fill” – animate of the Object (typically, a waypoint) while delay before activation is in progress.
Rect (0.2, 0.8, 0.1, 0.9) – rectangular area on the screen, in format (left, right, top, bottom); default is (0, 0, 1, 1).
Dir (0.27, 0.63, -0.46) – direction vector.
Direction (0.27, 0.63, -0.46) – the same as Dir.
Range (28.5, 36.4) – range of change of some value; units are parsecs, parsecs per second etc (depends on a trigger).
RangeKm (28500, 36400) – the same as Range for some triggers, units are kilometers or kilometers per second.
RangeRad (1.5, 2.5) – the same as Range for some triggers, units are object’s radii.
LonLatRange (48, 49, 36, 38) – range of change in a longitude and latitude of a camera position over a planet; units are degrees; format is (min lon, max lon, min lat, max lat).
YawRange (-15, 15) – range of change in a camera yaw angle in degrees.
PitchRange (-20, 20) – range of change in a camera pitch angle in degrees.
RollRange (-5, 5) – range of change in a camera roll angle in degrees.

}

If the ActivationDelay parameter is provided, the system waits specified amount of seconds after the trigger activation before throwing the actual activation event (giving control to the next script command). If the trigger activation conditions were broken (for example, user stopped looking at the object in “Object|See” trigger), this delay timer resets. The delay times can be used to animate the object, to which the trigger is linked (typically, the waypoint). The animation style is defined by the AnimateObject parameter:
“Fill” – fill the circle-shaped waypoint clockwise with another color (ColorEmpty to Color);
“FadeIn” – fade the waypoint in;
“FadeOut” – fade the waypoint ont;
“Rotate” – rotate the waypoint (works only with 2D shapes).

BeginMultitrigger

Start a sequence of multiple WaitTrigger commands. Script execution will be delayed until one or all triggers in the section are triggered. Syntax:
BeginMultitrigger “OR” – wait for one of the provided triggers.
BeginMultitrigger “AND” – wait for all of the provided triggers.

EndMultiTrigger

Start a sequence of multiple WaitTrigger commands. Syntax:
EndMultiTrigger – wait for one of the provided triggers.

Use the multi-trigger system if you want to wait for multiple triggers. For example, if you want to wait until the user selects Earth, then centers on it, use this code:

Code
BeginMultiTrigger “AND”
WaitTrigger “Object|Select” { Object “Earth-Moon|Earth” }
WaitTrigger “Control|Center”
EndMultiTrigger

List of triggers

There are many triggers available. Choose a needed trigger by specifying its name. Here is a description of all triggers, events which activate them, and parameters which triggers use.

Trigger nameActivation eventUsed parameters
“Control|Rotate”Camera is rotatingMode, YawRange, PitchRange, RollRange
Mode “OR” – activates if one of the provided angles are out of range
Mode “AND” – activates if all of the provided angles are out of range
“Control|Orbit”Camera is orbiting some object
“Control|Move”Camera is movingRange, Dir, Direction
Activates if camera passes a specified distance range, and/or moves in a specified direction (with accuracy of 1%)
“Control|MapZoom”The Universe map zoom changesRange
Activates if the map zoom is out of range
“Control|ChangeSpeed”Assigned camera speed is changedRange
Activates if the assigned camera speed falls within the range
“Control|StopRotate”Camera stops rotation
“Control|StopOrbit”Camera stops orbiting
“Control|StopMove”Camera stops moving
“Control|Goto”The ‘Go to’ command is activated by the userObject, Type
If Object is not specified, then the currently selected object is used.
Trigger activates if the command is applied to that object and/or type of objects.
“Control|GotoCenter”The ‘Go to center’ command is activated
“Control|Land”The ‘Land’ command is activated
“Control|Center”The ‘Center’ command is activated
“Control|Horizon”The ‘Horizon’ command is activated
“Control|MapCenter”The Universe map is centered on object
“Control|MapFocus”The Universe map is focused on object
“Control|Follow”The camera binding mode is changed to “Follow”
“Control|SyncRot”The camera binding mode is changed to “SyncRot”
“Control|Free”The camera binding mode is changed to “Free”
“Control|Track”Tracking of the object is enabled
“Control|Untrack”Tracking of the object is disabled
“Control|SetTime”User changes the simulation date/time
“Control|SetCurrentTime”User sets the simulation data/time to the current system clock
“Control|SetTimeRate”User changes the time flow speedRange
Activates if the time flow speed fits in the range
“Control|PauseTime”User pauses the time flow
“Control|ResumeTime”User resumes the time flow
“Control|ReverseTime”User reverses the time flow direction
“Time”Simulation time crosses the specified date or range of datesMode, Time, TimeRange
Mode “Crossed” – activates if the time crosses the Time value
Mode “Earlier” – activates if the time becomes earlier than the Time value
Mode “Later” – activates if the time becomes later than the Time value
Mode “InRange” – activates if the time goes in the TimeRange range
Mode “OutRange” – activates if time goes out of the TimeRange range
“Object|Select”Object is selectedObject
If Object is not specified, trigger activates when any object is selected.
“Object|See”Object appeared on the screenObject, Rect, ActivationDelay, AnimateObject
If Object is not specified, then the currently selected object is used.
Trigger activates if the object’s position on the screen fits into Rect, and user keeps it inside the Rect during Delay seconds. During these seconds, the Object is animated by the method AnimateObject. See Waypoints for details.
“Object|Approach”User approaches the objectObject, Type, Range, RangeKm, RangeRad, LonLatRange
If Object name is not specified, then the nearest detected object of specified type is used as the target.
If Type is “Selection”, then currently selected object is used as the target.
Trigger activates if the distance to target fits the Range, RangeKm or RangeRad, and/or camera longitude/latitude fits the LonLatRange.
“GUI|Open”Dialog window is openedDialog
“GUI|Close”Dialog window is closed
“GUI|LockPanel”Toolbar is locked
“GUI|HalfLockPanel”Toolbar is half-locked
“GUI|UnlockPanel”Toolbar is unlocked
“GUI|LeftClick”Widget is clicked with left mouse buttonDialog
Dialog is a widget name, see SetWidgetStyle for details.
“GUI|RightClick”Widget is clicked with right mouse button
“GUI|SelectObject”Object or type of objects is selected using interfaceObject, Type
“GUI|SSB|Enter”User entered the list of satellites in the Solar system browser
“GUI|SSB|Back”User exited to the upper level in the Solar system browser
“LoadingComplete”Loading of the scene is completeMaxWaitTime
Trigger activates when the loader task list becomes empty (scene loading is complete).
If MaxWaitTime is provided, trigger waits up to specified period of time, then activates.

Object type list

Some triggers require a Type parameter, describing a type of a SpaceEngine object. Possible values are summarized in the table below. Each type can be followed by a subtype or class, separated by ‘|’. For example: “Galaxy|SBc”, “Star|G2V”, “Body|Asteroid”, “Planet|Terra”.

TypeSubtype/classUsage example
SelectionNot used“Selection” – currently selected object
WaypointNot used“Waypoint” – any waypoint
GalaxyGalaxy Hubble class. See Creating a DSO for details.“Galaxy” – any type of galaxy
“Galaxy|Sa” – any Sa galaxy
“Galaxy|E5” – any E5 galaxy
ClusterStar cluster type: Open, Globular, Kern, Part. See Creating a DSO for details.“Cluster” – any type of cluster
“Cluster|Open” – any open cluster
“Cluster|Globular” – any globular cluster
NebulaNebula type: Diffuse, Planetary, SNR. See Creating a DSO for details.“Nebula” – any type of nebula
“Nebula|Diffuse” – any diffuse nebula
“Nebula|Planetary” – any planetary nebula
StarStellar spectral class. See Creating a star for details.“Star” – any type of star
“Star|G2V” – any G2V-type star
“Star|DA2” – any DA2-type star
Body
Planet
Moon
DwarfPlanet
DwarfMoon
Asteroid
Comet
Barycenter
StarBarycenter
Temperature class: torrid, hot, warm, temperate, cool, cold, frigid.
Volatiles class: airless, arid, lacustrine, marine, oceanic, superoceanic, nonarid.
Size class: micro, mini, sub, norm, super, mega.
Bulk composition class: astroidal, ferria, terra, carbonia, aquaria, neptune, jupiter, browndwarf, sun or legacy classes: desert, selena, oceania, waterworld, titan, iceworld, icegiant, gasgiant, jovian.
See Creating a planet for details.
“Planet” – any planet
“Planet|terra” – any terra (rocky) planet
“Planet|hot|super|terra” – any hot super-earth rocky planet
“Moon|cold|aquaria” – any cold icy moon
“Moon|temperate|marine|norm|terra” – any temperate marine earth-sized rocky moon
“Body” – any type of a planetary body (planet, moon etc)
“Body|terra” – any type of a terra (planet, dwarf planet, moon etc)
“Body|asteroidal|cold” – any type of cold asteroidal object (asteroid, comet, dwarf moon etc)
“Asteroid|cold” – any cold asteroid (note difference with previous example)
“Barycenter” – any barycenter of a binary planetary object
“StarBarycenter” – any barycenter of a binary star

Note the Bulk composition class asteroidal: in SE interface and catalog scripts it is “astroid”, but here it is “asteroidal” to distinguish it from the Type Asteroid.

VARIABLES

Show

Shows space object, effect or overlay. Syntax:
Show Clouds – shows clouds. All possible objects/effects/overlays are:
Planets, Stars, Clusters, Nebulae, Galaxies, Atmo, Atmospheres, Clouds, Water, Aurora, CometTails, Orbits, OrbitMarks, Vectors, SelPointer, VelVector, Grid, Labels, Markers, NightLights, Eclipses, PlanetShine, LensFlares.
It is possible to show/hide many more effects/overlays than provided in this list by using variables. See the Set command for details.

Hide

Hides space object, effect or overlay. Syntax:
Hide Clouds – hides clouds. All possible objects/effects/overlays are the same as in the Show command.

Set

Sets a variable with a range check. Syntax:
Set ClipHeight 5.0 – assigns a value of 5.0 to the variable ClipHeight.
Set ShowOrbitsDwarfMoons true – assigns a value of true to the boolean variable ShowOrbitsDwarfMoons.
If the value is out of the range which variable allows, it is clamped into the allowed range, and a warning message is printed to the console (except boolean variables, which have no range).

SetU

Sets a variable without range checking (‘unsafe’ set). Syntax:
SetU ClipHeight 5.0 – assigns a value of 5.0 to the variable ClipHeight.
If the value is out of the range which variable allows, it is assigned anyway, and a warning message is printed to the console. This command is equal to Set for boolean variables.

Reset

Sets a variable to its default value. Syntax:
Reset ClipHeight – assigns a default value to the variable ClipHeight.
Reset ShowOrbitsDwarfMoons – assigns a default value to the boolean variable ShowOrbitsDwarfMoons.
The default values for all variables are listed in the table below.

Get

Returns the current value of a variable. Syntax:
Get ClipHeight – returns the current value of the variable ClipHeight and prints it to the console.
Get ShowOrbitsDwarfMoons – returns the current value of the boolean variable ShowOrbitsDwarfMoons and prints it to the console.
For now, this command makes sense only if used in the console (in direct mode), just for the information.

WaitVar

Delays execution of the script until a variable matches the specified value. Syntax:
WaitVar ClipHeight 15 – delays the script until the variable ClipHeight matches the value of 15.
WaitVar ShowOrbitsDwarfMoons false – delays the script until the variable ShowOrbitsDwarfMoons matches the value of false.
If the variable already has the desired value, the command returns immediately (script is not delayed).

SaveVars

Saves current values of all variables and locks the states of the toolbars. Syntax:
SaveVars
It is recommended to call this command at the beginning of a script, if that script is not allowed to change the normal settings or state of SpaceEngine. When the script is finished, or interrupted due an error, or by the user, all saved data will be restored (equivalent of calling of the RestoreVars command).

RestoreVars

Restores values of all variables and lock-states of the toolbars, previously saved by the command SaveVars. Syntax:
RestoreVars
It is not necessary to call this command at the end of the script which uses SaveVars command, because variables will be restored automatically once script finishes. But you may call this command at any point of the script.

A boolean variable can be toggled (switched) just by typing its name:

Code
HardwareCursor

This is useful in direct mode for the debug cursor, but you may use this in scripts. This in not recommended though, because it makes scripts harder to understand, and in most cases you anyway need to assign some initial value to the variable.

List of variables

The table below has a full list of variables. Variables can be one of these types:

– boolean, has only 2 values: false and true, has no min/max values;
– integer, a integer number (32-bit);
– float, a single-precision floating-point number (IEEE 754 FP32).
– double, a double-precision floating-point number (IEEE 754 FP64).

Integer and float variables have a minimum and maximum value, which are taken into account by the Set command. All variables have default values, which are assigned to them at the program startup or by the Reset command. Most variables are read from the config file at the program startup.

Some boolean variables are marked as a cheat code. Setting them to true displays a message “Cheater!”, and enables some really cheat-y functions in gameplay.

NameTypeDefaultMinMax
DEAMaxTermsinteger10000010000
StarColorShiftfloat0-11
StarColorSaturationfloat102
SunIllumSaturationfloat102
RealTimebooleanfalse
RealTimeFPSdouble3011000
FullConstellationNamesbooleantrue
ConstelBordersAtInfbooleantrue
ConstelBordersRadiusfloat2001e+06
ConstelBordersFadeStartfloat20001e+06
ConstelBordersFadeEndfloat80001e+06
ConstelLinesFadeStartfloat400001e+06
ConstelLinesFadeEndfloat800001e+06
ConstLinesAllbooleanfalse
ConstBoundaryAllbooleanfalse
ConstLabelAllbooleanfalse
ConstLinesZodiacbooleanfalse
ConstBoundaryZodiacbooleanfalse
ConstLabelZodiacbooleanfalse
LensFlareScalefloat10.110
LensFlareBrightfloat10.110
PseudoFlareBrightfloat10.110
MaxTimePerFrameCleanfloat2011000
MaxTimePerFrameCleanVRfloat2011000
LinkStereobaseToMoveSpeedbooleantrue
LinkStereobaseToTimeScalebooleanfalse
StereobaseToMoveSpeedfloat0.00101
StereobaseToTimeScalefloat0.601000
PhotoModeinteger002
ProjectionModeinteger003
StereoscopicModeinteger006
StereoscopicModeLastinteger206
ForceStereoscopicModeinteger006
CubemapFormatinteger005
VSyncinteger202
Brightnessfloat102
Contrastfloat102
Saturationfloat102
Vibrancefloat002
Sharpnessfloat002
BloomBrightfloat0.701
ShowBackgroundbooleanfalse
ShowCubempEdgesbooleanfalse
FitCubemapToScreenbooleantrue
LinesSmoothingbooleantrue
LinesWidthfloat1010
AnisotropyLevelinteger0016
StereoInterlacedbooleanfalse
StereoSwapEyesbooleanfalse
StereoIPDfloat6.4110
StereoConvergencefloat10.52
Stereobasefloat111e+25
MipmapsGUIbooleantrue
MipmapsFramebooleantrue
MipmapsEnvbooleantrue
MSAALevelinteger0032
MSAALevelVRinteger0032
MSAALevelEnvinteger0032
MSAALevelEnvVRinteger0032
MSAALevelImpinteger0032
FXAAbooleantrue
Ditheringbooleantrue
FastCubemapbooleanfalse
TestGridbooleanfalse
DistortInterfacebooleanfalse
FisheyeFlipXbooleanfalse
FisheyeFlipYbooleanfalse
FisheyeFOVfloat18040360
FisheyeGUIAnglefloat90-9090
FisheyeZoomfloat113
FisheyeCropfloat112
fxaaSubpixfloat0.7501
fxaaEdgeThresholdfloat0.1250.06250.3333
fxaaEdgeThresholdMinfloat0.08330.03120.0833
WatermarkOpacityfloat0.501
OverlayFadeInfloat0.2060
OverlayFadeOutfloat0.35060
WidgetFadeInfloat0.2060
WidgetFadeOutfloat0.35060
WidgetSlideInfloat0.2060
WidgetSlideOutfloat0.02060
BottomInfoHUDbooleanfalse
LessonPassedinteger-1-1100
TypeAtmoClassbooleanfalse
TypeVolTempClassbooleanfalse
GasGiantClassStyleinteger001
TerrestrialClassStyleinteger001
MusicVolumeinteger200100
MusicRepeatModeinteger003
MusicOrderModeinteger002
MixDurationGUIfloat20.0160
MixDurationLoopfloat100.0160
MixDurationContextfloat50.0160
MixDurationScriptfloat10.0160
MinTrackPlayingTimefloat200.01300
MusicShowTitlebooleantrue
UnitDistLargeinteger101
UnitDistMediuminteger223
UnitDistSmallinteger446
UnitRadiusLargeinteger001
UnitRadiusMediuminteger112
UnitRadiusSmallinteger223
UnitMassLargeinteger001
UnitMassMediuminteger112
UnitMassSmallinteger223
UnitTemperatureinteger102
UnitPressureinteger005
SelectionRadiusbooleanfalse
AtmoHeightHarbbooleantrue
AtmoBottomOffsetfloat0.000100.1
AtmoDistanceLimitfloat30110000
AtmoMinWidthPixfloat1010
AuroraBrightfloat10.01100
PlanetShineUpdateFramesinteger51100
StarFrustumClipFOVfloat300120
CometTailBrightfloat10.01100
EngineSampleStepfloat0.10.0011
LandLODfloat0-11
MipmapsModeinteger202
MipmapsLandbooleantrue
LandFiltNearestbooleanfalse
LandProcDetailbooleantrue
PlanetVSFetchingbooleanfalse
PlanetReverseLoadingbooleantrue
LandSpareFactordouble1010
PlanetHeightmapFormatinteger13116
PlanetShineBrightfloat10.110
SelfEmissionBrightfloat10.110
ThermalEmissionShiftfloat0-22
ExposureCompfloat0-424
AutoExpNightVisionfloat1110
AutoExpSensitivityfloat0.180.01100
AutoExpMaskSizefloat10.01100
AutoExpMaskValuefloat2.50.01100
FrameDynamicRangefloat1000011e+06
BloomDynamicRangefloat5011e+06
hdrDeepSpaceObjBrightfloat0.451.17549e-383.40282e+38
hdrStarSurfaceBrightfloat10001.17549e-383.40282e+38
hdrPlanetSurfaceBrightfloat11.17549e-383.40282e+38
hdrWaterSurfaceBrightfloat11.17549e-383.40282e+38
hdrShipModelBrightfloat11.17549e-383.40282e+38
hdrAtmoScatterBrightfloat11.17549e-383.40282e+38
hdrAtmoIllumBrightfloat11.17549e-383.40282e+38
hdrPlanetRingsBrightfloat11.17549e-383.40282e+38
hdrCometTailBrightfloat11.17549e-383.40282e+38
hdrAccretionJetBrightfloat11.17549e-383.40282e+38
hdrStarCoronaBrightfloat11.17549e-383.40282e+38
hdrAuroraBrightfloat11.17549e-383.40282e+38
hdrEmissionBrightfloat1110000
hdrShipEnginesBrightfloat1110000
realDeepSpaceObjBrightfloat0.451.17549e-383.40282e+38
realStarSurfaceBrightfloat1e+091.17549e-383.40282e+38
realPlanetSurfaceBrightfloat11.17549e-383.40282e+38
realWaterSurfaceBrightfloat11.17549e-383.40282e+38
realShipModelBrightfloat11.17549e-383.40282e+38
realAtmoScatterBrightfloat11.17549e-383.40282e+38
realAtmoIllumBrightfloat11.17549e-383.40282e+38
realPlanetRingsBrightfloat11.17549e-383.40282e+38
realCometTailBrightfloat0.051.17549e-383.40282e+38
realAccretionJetBrightfloat11.17549e-383.40282e+38
realStarCoronaBrightfloat1001.17549e-383.40282e+38
realAuroraBrightfloat101.17549e-383.40282e+38
realEmissionBrightfloat3110000
realShipEnginesBrightfloat100110000
AmbientLightingfloat001
PointOverbrightfloat105
MapPointOverbrightfloat105
PointFlareBrightfloat10.01100
PointFlareDecayfloat10.01100
PointDesaturationfloat10.01100
PlanetMagnLimitfloat6-1020
StarMagnLimitfloat6-1020
ClusterMagnLimitfloat6-1020
NebulaMagnLimitfloat6-1020
GalaxyMagnLimitfloat6-1020
GlowMagnLimitfloat6-1020
CheatsMenubooleanfalsecheat code
Collisionsbooleantruecheat code
Gravitybooleantruecheat code
Aerobooleantruecheat code
UFObooleanfalsecheat code
FTLbooleanfalsecheat code
Godbooleanfalsecheat code
TARDISbooleanfalsecheat code
ShipDrawModeinteger104
WaypointsOpacityfloat101
ExitToMenuOnScriptErrorbooleanfalse
BoolVar0booleanfalse
BoolVar1booleanfalse
BoolVar2booleanfalse
BoolVar3booleanfalse
IntVar0integer0-21474836482147483647
IntVar1integer0-21474836482147483647
IntVar2integer0-21474836482147483647
IntVar3integer0-21474836482147483647
FloatVar0float0-3.40282e+383.40282e+38
FloatVar1float0-3.40282e+383.40282e+38
FloatVar2float0-3.40282e+383.40282e+38
FloatVar3float0-3.40282e+383.40282e+38
SoundVolumeinteger200100
FlySpeeddouble01.17549e-383.40282e+38
TurnSpeeddouble01.17549e-383.40282e+38
OrbitSpeeddouble01.17549e-383.40282e+38
ChartShowStarsbooleantrue
ChartShowPlanetsbooleantrue
ChartShowDwarfPlanetsbooleantrue
ChartShowMoonsbooleantrue
ChartShowDwarfMoonsbooleantrue
ChartShowAsteroidsbooleanfalse
ChartShowCometsbooleanfalse
ChartShowPlanBarybooleantrue
ChartLockedCamerabooleantrue
ChartLightingAngleinteger35-9090
MapExploreModebooleanfalse
MapShowProceduralbooleantrue
MapLabelsModeinteger102
MapDensityinteger8010200
MapDensityScaleExplinteger10011000
testFloatfloat0-11
testIntinteger0-100100
TextModeinteger102
DebusScreeninteger102
FPSbooleanfalse
HardwareCursorbooleanfalse
HideCursorbooleanfalse
MotionBlurLengthfloat0-1010
StarFadeDurationfloat0.50.0110
PlanetShineModeinteger102
AutoExposureSpeedfloat2.50300
PointScalefloat10.52
LinkScaleToScreenResbooleantrue
StarPointMethodinteger203
PlanetPointMethodinteger103
AutoGalaxyMagnitudebooleantrue
AutoGalaxyMagnSpeedfloat30.01100
PlanetDetailTexturesbooleantrue
TextureCompressbooleantrue
TextureCompressDiffbooleantrue
TextureCompressNormbooleantrue
TextureCompressEmisbooleantrue
TextureCompressDetbooleantrue
ShowCatGalaxiesbooleantrue
ShowProcGalaxiesbooleantrue
ShowCatClustersbooleantrue
ShowProcClustersbooleantrue
ShowCatNebulaebooleantrue
ShowProcNebulaebooleantrue
ShowCatStarsbooleantrue
ShowProcStarsbooleantrue
ShowCatPlanetsbooleantrue
ShowProcPlanetsbooleantrue
ShowProcCSPlanetsbooleantrue
ShowSpacecraftbooleantrue
OrbitTrailsLengthfloat0.72501
OrbitMajorThicknessfloat5220
OrbitMinorThicknessfloat2220
ShowOrbitsShipsbooleantrue
ShowOrbitsPlanetsbooleantrue
ShowOrbitsMoonsbooleantrue
ShowOrbitsDwarfPlanetsbooleantrue
ShowOrbitsDwarfMoonsbooleantrue
ShowOrbitsAsteroidsbooleantrue
ShowOrbitsCometsbooleantrue
ShowOrbitsSunsbooleantrue
ShowOrbitsBarycentersbooleantrue
ShowLabelsShipsbooleantrue
ShowLabelsPlanetsbooleantrue
ShowLabelsMoonsbooleantrue
ShowLabelsDwarfPlanetsbooleantrue
ShowLabelsDwarfMoonsbooleantrue
ShowLabelsAsteroidsbooleantrue
ShowLabelsCometsbooleantrue
ShowLabelsSunsbooleantrue
ShowLabelsBarycentersbooleantrue
ShowLabelsStarsbooleantrue
ShowLabelsClustersbooleantrue
ShowLabelsNebulaebooleantrue
ShowLabelsGalaxiesbooleantrue
ShowLabelsWaypointsbooleantrue
ShowMarkersShipsbooleantrue
ShowMarkersPlanetsbooleantrue
ShowMarkersMoonsbooleantrue
ShowMarkersDwarfPlanetsbooleantrue
ShowMarkersDwarfMoonsbooleantrue
ShowMarkersAsteroidsbooleantrue
ShowMarkersCometsbooleantrue
ShowMarkersSunsbooleantrue
ShowMarkersBarycentersbooleantrue
ShowMarkersStarsbooleantrue
ShowMarkersClustersbooleantrue
ShowMarkersNebulaebooleantrue
ShowMarkersGalaxiesbooleantrue
AuroraQualityinteger101
BlackHoleQualityinteger203
ShipWarpQualityinteger203
SilentVarChangebooleanfalse
EditGUIbooleanfalse
FindEarthsbooleanfalsecheat code
NoClipbooleanfalsecheat code
ClipHeightdouble0.00101
ClipZNeardouble0.00501
AutoHorizonbooleanfalse
SparseStarSystemsSearchbooleantrue
SparseGalaxiesSearchbooleantrue
MaxGraphicsbooleanfalse
PipelineModeinteger001
DrawLandbooleantrue
DrawWaterbooleantrue
DrawCloudsbooleantrue
DrawSkybooleantrue
DrawFlaresbooleantrue
DrawFrontTexbooleantrue
ForceGasGiantCloudsbooleantrue
LandRLSortinteger103
CloudsSpeedfloat1-1e+091e+09
ShowMessagesbooleantrue
MessageTimeoutfloat2010
ShowBBoxLabelsbooleanfalse
ShowStarOctreebooleanfalse
ShowCatStarOctreebooleanfalse
ShowGalOctreebooleanfalse
ShowCatGalOctreebooleanfalse
ShowGalSysOctreebooleanfalse
ShowClusOctreebooleanfalse
ShowGalModelBoxesbooleanfalse
ShowNebModelBoxesbooleanfalse
ShowLandQuadtreeinteger002
CacheSizeLandNodeinteger00100000
CacheSizeStarNodeinteger00100000
CacheSizeGalNodeinteger00100000
CacheSizeGalModelsinteger200256
CacheSizeAtmoModelsinteger0064
TimeScaledouble1-1e+121e+12
TimeScaleGamedouble1010000
logFarPlanefloat1e+2001e+30
LogTimeStampbooleanfalse
LogThreadStampbooleantrue
MarkersSizefloat70.01100
MarkersSizeVRfloat100.01100
LabelsSizefloat10.01100
LabelsSizeVRfloat10.01100
LabelsPosPlanetinteger203
LabelsPosDSOinteger203
NebulaLightingbooleanfalse
BlackHoleJetsbooleantrue
BlackHoleSmallNoiseTexbooleantrue
CosmHorizonfloat4.2e+0903.40282e+38
LightDimmingMagnfloat-15-100100
LightLimitMagnfloat-10-100100
LensFlareFadeBeginMagnfloat-17-100100
LensFlareFadeEndMagnfloat-12-100100
dbgCheckGLErrorsbooleantrue
dbgShowLandDetTexArraysinteger103
dbgSaveCompressedLandTexbooleanfalse
OpenMenuIfScriptErrorbooleanfalse
ScreenshotAlphabooleanfalse
SelectedObjectTypeinteger909
BuildingCollisionbooleantrue
ShowBuildingOctreebooleanfalse
ShowBuildingPolysbooleantrue
ShowBuildingLinesbooleanfalse
ShowBuildingVertsbooleanfalse
TestBuildingOctreebooleanfalse
TestBuildingDrawbooleanfalse
DrawBuildingLightRadiusbooleanfalse
ShowBuildingEntitybooleantrue
BuildingTestBrushinteger000
BuildingTestPolyinteger000
BuildingTestLeafinteger000
BuildingCollisionStepsinteger11100
LoaderAsyncTexturesbooleanfalse
LoaderAsyncMeshesbooleanfalse
LoaderAsyncShadersbooleanfalse
PauseLoaderbooleanfalse
Benchmarkbooleanfalse
MaxThreadsinteger10110
MaxTilesPerFrameinteger21100
MaxTilesPerFrameVRinteger21100
MaxTimePerFramefloat2011000
MaxTimePerFrameVRfloat2011000
VRPlatforminteger0010
VRRuntimeinteger002
UsedVRRuntimeinteger002
VRMirrorinteger304
VRInterfaceCopiesinteger418
VRMoveDirectioninteger202
VRMouseCursorModeinteger102
VRDiscreteTurnsbooleanfalse
VRLimitFOVbooleantrue
VRSwapHandsbooleanfalse
VRUseHWProxSensorbooleantrue
VRAutoPausebooleantrue
VRAutoExitToMenubooleanfalse
VRRenderScaleAutobooleanfalse
VRRenderScalefloat10.71
VRRenderScaleMinfloat0.502
VRRenderScaleMaxfloat102
VRRenderScaleMinFPSfloat0.3301
VRRenderScaleMaxFPSfloat0.501
VRInfoTimeoutfloat10060
VRMoveControllerinteger001
VRSelectControllerinteger101
Controller1RayDirinteger001
Controller2RayDirinteger001
INTERFACE COMMANDS

FadeOut

Fades out the scene into a specified solid color. Syntax:
FadeOut – fade out with default parameters.
FadeOut { … } – fade out with custom parameters provided below:
{

Time 3.0 – duration of fade out in seconds; default is 0.25.
Color (0.2, 0.0, 0.2) – fade color in (R, G, B) format; default is black – (0, 0, 0).

}

FadeIn

Fades in to the scene. Syntax:
FadeIn – fade in with default parameters.
FadeIn { … } – fade in with custom parameters provided below:
{

Time 3.0 – duration of fade in seconds; default is 0.25.

}

Print

Displays an onscreen message. Syntax:
Print “blabla” – displays a message “blabla” with a default parameters.
Print “blabla” { … } – displays a message “blabla” with custom parameters provided below:
{

Time 10.0 – timeout of the message: it will be hidden after the specified time in seconds; default is 5.
Color (1.0, 0.8, 0.3, 1.0) – color of the message text in (R, G, B, A) format (A is opacity); default is white – (1, 1, 1, 1).
PosX 0.8 – horizontal position of the message in screen fractions (i.e. 0.0 is leftmost, 1.0 is rightmost); default – see remarks.
PosY 0.2 – vertical position of the message in screen fractions (i.e. 0.0 is topmost, 1.0 is bottommost); default – see remarks.
AlignX “center” – horizontal align; possible values: “left”, “center”, “right”; default is “center”.
AlignY “down” – vertical align; possible values: “top”, “center”, “down”; default is “down”.

}
If the PosX/PosY are provided, then AlignX/AlignY defines the alignment of the message text relative to the static point specified by PosX/PosY parameters. Otherwise the message text will use dynamic positioning in the free screen area and will be aligned according to provided or default values of AlignX/AlignY. This dynamic position means that if the user opens some toolbars, the displayed text will be moved so it will not overlap the toolbars. You may use any combination of these 4 parameters, i.e. define static/dynamic position and alignment for X and Y coordinates independently.
Message text supports BBCode: you may change the color, font, size, use lower and upper index, special symbols. See the BBCode table in the Appendix for more details.

HidePrint

Removes the onscreen message displayed previously by the Print command. Syntax:
HidePrint

WaitMessage

Displays a message box dialog with a specified text and button [Next]. Syntax:
WaitMessage “blabla” – displays a message box with a text “blabla”.
The script execution delays until user presses the [Next] button. The message box will hide itself after that. Pressing the close button interrupts the script.
Message text supports BBCode: you may change the color, font, size, use lower and upper index, special symbols. See the BBCode table in the Appendix for more details.

ShowMessage

Displays a message box dialog with a specified text. Syntax:
ShowMessage “blabla” – displays a message box with a text “blabla”.
The script execution continues immediately to the next command. The message box remains visible until the command HideMessage or another WaitMessage/ShowMessage is executed, or until the user presses the close button on the dialog. Pressing the close button interrupts the script.
You may use this command to display a message box before some WaitTrigger command.
Message text supports BBCode: you may change the color, font, size, use lower and upper index, special symbols. See the BBCode table in the Appendix for more details.

HideMessage

Hides the message box displayed previously by the WaitMessage/ShowMessage. Syntax:
HideMessage

ShowDialog

Shows the dialog window or toolbar. Syntax:
ShowDialog “Find object” – shows the specified dialog by its name, ‘Find object’ dialog in this example.
The name of a dialog is usually visible on its header. The English localization must be used to determine the name for this command; switch to English in User settings. Names are case-sensitive. Note: some interface skins forced the UPPER CASE font in the dialog’s window header. Use skins which don’t do this to determine the name of the dialog.
The list of dialogs and toolbars which have no header: “Main toolbar”, “Navigation toolbar”, “Brightness toolbar”, “Filters toolbar”, “Solar system browser”, “Universe map”, “System chart”, “Nebula editor”, “Planet editor”, “Ship editor”, “Message box”.

HideDialog

Hides the dialog window or toolbar. Syntax:
HideDialog “Find object” – hides the specified dialog by its name, ‘Find object’ dialog in this example.
Notes about dialog name are the same as in ShowDialog.

HideAllDialogs

Hides all dialog windows; toolbars will not be hidden. Syntax:
HideAllDialogs

HideAllToolbars

Hides all toolbars; dialog windows will not be hidden. Syntax:
HideAllToolbars

OpenMenu

Opens the main menu or a specified sub-menu. Syntax:
OpenMenu “Main” – opens the Main menu.
OpenMenu “Main|Settings” – opens the Main menu > Settings sub-menu.
OpenMenu “Main|Editor” – opens the Main menu > Editor sub-menu.
OpenMenu “Main|Planetarium|Tutorial” – opens the Main menu > Planetarium > Tutorial sub-menu.

CloseMenu

Closes the main menu or a sub-menu. Syntax:
CloseMenu

EnterPlanetarium, EnterSinglePlayer, SessionContinue

Smoothly closes main menu and enters the planetarium mode (EnterPlanetarium), single player mode (EnterSinglePlayer), or last used mode (SessionContinue). Loading screen is shown if needed. Script execution will be delayed and continue when scene completes loading or user presses the Esc button to cancel out the loading screen. Simultaneously, scene fade-in animation starts. Syntax:
EnterPlanetarium – enters planetarium with default values.
EnterPlanetarium { … } – changes defaults by a parameters provided below:
{

ShowLoadingScreen false – disables loading screen; user may see scene loading process. Script execution continues when menu fade-out animation completes. Default is true.
AutoFadeIn false – disables scene fade-in after loading completes or menu fade-out animation completes. Screen stays black, so you must call FadeIn later in the script. Default is true.
FadeInTime 2.0 – modifies scene fade-in animation time. Default is -1, which means using the WidgetFadeIn variable value.

}

SetWidgetStyle

Changes style of a specified widget (interface element). Syntax:
SetWidgetStyle “Widget name” { … } – changes the style of the widget “Widget name”; the style is specified by a parameters provided below:
{

WinColor (1.0, 0.0, 0.0, 0.8) – color of the widget’s contour and filling in (R, G, B, A) format (A is opacity); modulates the current skin color.
TextColor (0.0, 1.0, 0.0, 1.0) – color of the widget’s text in (R, G, B, A) format (A is opacity); modulates the current skin color.
Pos (0.5, 0.3) – position of the widget relative to parent, in units of parent’s size.
PosPix (600, 300) – position of the widget relative to parent, in pixels.

}
You may change the style of a dialog window or toolbar by specifying its name, as described in ShowDialog. You may also change style of any control (button, checkbox, label etc). To do this, first determine its name. Usually it matches the name of this control in English localization; sometimes it is some generic name such as “#35”. The name of an icon button can be determined if you hold mouse cursor over it: the hint appearing with the button name. Separate its name from a parent widget name with a ‘|’. Names are case-sensitive. Examples:
SetWidgetStyle “Main toolbar” – the Main toolbar.
SetWidgetStyle “Main toolbar|System chart” – the System chart button on the Main toolbar.
SetWidgetStyle “Graphics|Planets” – the Planets group contour line on the Graphics settings dialog.
SetWidgetStyle “Graphics|Planets|Eclipse shadows” – the Eclipse shadows checkbox on the Graphics settings dialog (its parent is the Planets group).
If a widget is a dialog window, its parent is the screen (SpaceEngine’s window client area), so Pos (0.5, 0.5) moves window to the center of screen (more precisely, its top-left corner will be in the center of the screen). If the widget is a button, checkbox etc, Pos/PosPix parameters move it relative to its parent. Warning: be careful with moving/coloring the interface components, the only way to restore their positions and colors is restarting SpaceEngine.

HighlightWidget

Makes specified widget blink. Syntax:
HighlightWidget “Widget name” – starts widget blinking with default parameters.
HighlightWidget “Widget name” { … } – starts a widget blinking with custom parameters provided below:
{

Time – blinking duration in seconds. Default is infinity (widget will not stop blinking until another HighlightWidget command).
Freq – blinking frequency in Hertz (blinks per second). Default is 4.
Color (1.0, 0.5, 1.0, 0.8) – blinking color in (R, G, B, A) format (A is opacity); modulates the current skin color; default is red – (1.0, 0.2, 0.2, 1.0).

}
To stop widget blinking, use HighlightWidget “”.
The message box dialog shown by WaitMessage and ShowMessage commands has a dynamic header, text label and buttons. Use these names to refer to them in the HighlightWidget and SetWidgetStyle commands: “Message box”, “Message box|Message text”, “Message box|Button 1”, “Message box|Button 2”.

SOUND COMMANDS

PlayMusic

Switches the music playback to a specified track. Syntax:
PlayMusic “filename.ogg” – switch to a file filename.ogg, the file must be in the data/music/ or addons/*/music/ folder.

PauseMusic

Pauses the music playback. Syntax:
PauseMusic

ResumeMusic

Resumes the music playback. Syntax:
ResumeMusic

UTILITY COMMANDS

Screenshot

Takes a screenshot and saves to the disk. Syntax:
Screenshot – takes a screenshot without interface and saves to the default folder screenshots/, with automatic file name and with default format (specified in the Player settings dialog).
Screenshot { … } – takes a screenshot with custom options:
{

GUI true – takes a screenshot with interface visible. Default is false (without interface).
Format “tif” – set a screenshot format. Possible values: “jpg”, “jpeg”, “tif”, “tiff”, “tga”, “png”, “dds”. Default is whatever is set in the Player settings dialog.
Name “prefix” – set a screenshot file name prefix. Default is “scr”.

}
The path and file name of the screenshot have a form of screenshots/prefixNNNNN.format where prefix is specified by the Name parameter (default is scr), format is specified by the Format parameter (from the Player settings dialog), and NNNNN is a automatically increased number from 00000 to 99999. Path is relative to the screenshots/ folder, so you may specify a custom relative path as a part of the prefix, for example Name “../scr” will save screenshot to the main SpaceEngine folder.

SavePNG, SaveTGA, SaveJPG, SaveDDS, SaveTIF

Loads a specified image file and saves it to the format, specific for each command. Syntax:
SavePNG “addons/my_addon/textures/spacecraft/texture.tga” – saves the image file on provided path to the same folder in the PNG format. If there are no errors, the file texture.png will appear in the same folder.
SaveJPG “addons/my_addon/textures/spacecraft/texture.*” – saves the latest modified image which path matches the provided mask to the same folder in the JPG format. If there are no errors, the file texture.jpg will appear in the same folder. If there are multiple files with the same file name texture of different extensions, the latest (newest) file will be loaded. If that file is not of supported image types (dds, tga, png, jpg, jpef, tif, tiff), the command fails.

OptimizeSM

Loads spacecraft SM model and saves it to a smaller (optimized) format.Syntax:
OptimizeSM “addons/MyShip/models/spacecraft/Battlecruser.sm” – saves specified file to a default (int) format.
OptimizeSM “addons/MyShip/models/spacecraft/Battlecruser.sm” { … } – use additional options:
{

Format “int_full” – change format. Possible values: “float_full”, “half_full”, “int_full”, “float_no_uv”, “half_no_uv”, “int_no_uv”. Default is “int_full”.
Recenter true – re-centers the model.

}
When importing ship model from obj, SpaceEngine creates the sm file which uses 32-bit floating-point (FP32) values for all vertex attributes: coordinates, normals, texture UVs. Usually such accuracy is redundant and model can be saved using 16-bit floating point (FP16) or even 16-bit integer values. This reduces file size significantly, and also reduces its memory footprint in SE. The OptimizeSM command converts file to the specified format and saves it to the same directory as the original file and with the same name, adding suffix “_int_full”, “_half_full” or whatever format has been chosen. The conversion process and possible errors are typed to the log file (system/se.log). To test new model in SE, you must update the ship’s model cfg file – specify the new file name by the Mesh parameter (see importing ship model from obj for details). After you done with debugging, you may remove the original sm file and rename the new file by removing the suffix.
The formats “float_no_uv”, “half_no_uv”, “int_no_uv” are designed for meshes without texture UVs, but still experimental. Don’t use them.

Watermark

Loads a custom image and displays it on screen as an transparent overlay. Useful to make “reality comparison” screenshots. Syntax:
Watermark
{

Path “C:/images/Pluto New Horizons.jpg” – path to the image file.
Opacity 0.5 – opacity of the overlay. Default is 0.5.
Visible false – enable/disable overlay. Default is true (enable).

}
You may make a simple script which will display and hide the overlay texture every second (simulation of the blink-comparator technique widely used in astronomy). Use the sequence of Watermark { Visible true }, Wait 0.5, Watermark { Visible false }, Wait 0.5 enclosed by the Loop / EndLoop commands.

Edit

Toggles an editor for a selected object: the planet editor for a planetary object, or the ship editor for a space ship. Syntax:
Edit

Quit, Exit

Closes SpaceEngine. Syntax:
Qxit
Exit

DEBUG COMMANDS

These commands are used by developers, you really don’t need them.

Map

Loads an indoor map file and switches engine to it. Syntax:
Map filename – loads a map file filename.map, the file must be in the data/models/buildings/ or addons/*/models/buildings/ folder.

Scene

Switches a specified scene. Syntax:
Scene map – switches to an indoor map previously loaded by the Map command.
Scene space – switches back to the Universe (planetarium).
Scene universe – switches back to the Universe (planetarium).

DebugGen

Launches a debugging tool of the procedural terrain texture generator. Syntax:
DebugGen

ReloadConstellations

Reloads constellation files.

Rebuild

Rebuilds the cache. Syntax:
Rebuild nebulae – clears the nebulae model cache in memory and removes the cache/nebulae/ folder.
Rebuild shaders – reloads all shaders which are currently in use.

PrintTexCacheLog

Prints to the console list of textures which are currently cached.
PrintTexCacheLog

PrintNames

Prints to the console all forms of the ‘name string’ of a selected object. Syntax:
PrintNames true – print names with replacement of abbreviations to actual characters.
PrintNames false – print names without replacement of abbreviations.

PrintFont

Prints to the console all glyphs of the specified font size. Syntax:
PrintFont – print all glyphs of a font of size 1 in 16 columns.
PrintFont 2 – print all glyphs of a font of size 2 in 16 columns.
PrintFont 2 32 – print all glyphs of a font of size 2 in 32 columns.
Possible font sizes are: 0, 1, 2, 3.

PrintVars

Prints to the console all SpaceEngine variables. Syntax:
PrintVars – print all variables.
PrintVars { … } – print variables with additional options:
{

Type “bool” – print only boolean variables.
Type “int” – print only integer variables.
Type “float” – print only float variables.
Type “double” – print only double variables.
Attachment true – print only variables with internal attachments.
html true – print variables in form of html table, used in this manual (for quick update of the manual).

}

dbSort

Sorts and saves the local database file (data/locale/loc-db.cfg and config/user-loc-db.cfg, where loc is a current localization). Syntax:
dbSort “none” – no sort.
dbSort “name” – sort by object’s name.
dbSort “locname” – sort by object’s localized name.
dbSort “parname” – sort by object’s parent name; if parent name matches, sort by object’s name.
dbSort “parlocname” – sort by object’s parent name; if parent name matches, sort by object’s localized name.