Warning
This documentation is currently under development! It should not be relied upon at this time.
<command>
#
The <command>
tag represents an action within FlightGear XML files. It is typically used as a
child element, such as in <binding>, to map an action to a user input
(e.g., a keyboard key or joystick button).
Because of the large number of values that can be passed to the <command>
element, it is quite a
powerful command that is used across many different aspects of the simulator.
open-browser
#
Description:
The open-browser
command is used to open a URL in the users web browser, typically for providing
easy access to online documentation.
Syntax:
<binding>
<command>open-browser</command>
<path></path>
</binding>
<binding>
<command>open-browser</command>
<url></url>
</binding>
null
#
Description:
The null
command does nothing. It is useful when no action is required.
Syntax:
<command>null</command>
exit
#
Description:
The exit
command exits the simulator when triggered.
Syntax:
<command>exit</command>
pause
#
Description:
The pause
command pauses the simulator when triggered.
Syntax:
<command>pause</command>
nasal
#
Description:
The nasal
command triggers execution of Nasal code.
Usage:
A <script> element must be used alongside the <command> element. The <script> element must be provided a value containing the Nasal code to be executed.
Syntax:
<command>nasal</command>
Example:
<binding>
<command>nasal</command>
<script>print("Hello from Nasal!")</script>
</binding>
- load - load properties from an XML file
- file: the name of the file to load, relative to the current
directory (defaults to “fgfs.sav”)
- save - save properties to an XML file
- file: the name of the file to save, relative to the current
directory (defaults to “fgfs.sav”).
- loadxml - load XML file into property tree
filename: the path & filename of the file to load targetnode: the target node within the property tree where to store the XML file’s structure. If targetnode isn’t defined, then the data will be stored in a node “data” under the argument branch.
- savexml - save property tree node to XML file
filename: the path & filename for the file to be saved sourcenode: the source node within the property tree where the XML file’s structure is assembled from. If sourcenode isn’t defined, then savexml will try to save data stored in a node “data” in the argument branch.
- panel-load - (re)load the 2D instrument panel
- path: the path of the XML panel file, relative to $FG_ROOT (defaults
to the value of /sim/panel/path if specified, or “Panels/Default/default.xml” as a last resort.
- preferences-load - (re)load preferences
- path: the file name to load preferences from, relative to $FG_ROOT.
Defaults to “preferences.xml”.
view-cycle
#
Description:
The view-cycle
command cycles to the next view, for example, changing from the “Helicopter View”
to the “Chase View”.
screen-capture
#
Description:
The screen-capture
command captures the current screen to a file.
Syntax:
<command>screen-capture</command>
Example:
Todo
Add an XML example here.
tile-cache-reload
#
Description:
The tile-cache-reload
command reloads the scenery tile cache.
Syntax:
<command>tile-cache-reload</command>
Example:
Todo
Add an XML example here.
property-toggle
#
Description:
The property-toggle
command toggles a boolean property value - if the property was previously
false
, it will be toggled to true
, and vice-versa.
Usage:
When a <command>
element is passed a value of property-toggle
, there must be an accompanying
<property>
element to indicate the property that should be toggled.
Example:
One common usecase for the property-toggle
command is in the creation of bindings for input
devices such as joysticks. Assuming we are creating an XML configuration for an input device, and
wanted to create a binding that would toggle the parking brake, the XML would look like:
<binding>
<command>property-toggle</command>
<property>/controls/gear/brake-parking</property> <!-- Note the included property element -->
</binding>
property-assign
#
Description:
The property-assign
command assigns a value to a property.
Usage:
The property-assign
command takes the following arguments:
property[0]
: the name of the property that will get the new value.value
: the new value for the property.property[1]
: the name of the property holding the new value.
Example:
<command>property-assign</command>
<property>/controls/gear/brake-parking</property>
<value>true</value>
property-interpolate
#
Description:
The property-interpolate
command assigns a value to a property, interpolated over time.
Usage:
The property-interpolate
command takes the following arguments:
property[0]
: the name of the property that will get the new value and defines the starting point of the interpolation.value
: the new value for the property; orproperty[1]
: the name of the property holding the new value.time
: the time in seconds it takes for the transition from the old value to the new value ofproperty[0]
; orrate
: the ammount of change per second the value of property[0] changes to transition to the new value.
property-adjust
#
Description:
The property-adjust
command adjusts the value of a property.
Usage:
The property-adjust
command takes the following arguments:
property
: the name of the property to increment or decrement.step
: the amount of the increment or decrement (defaults to 0).offset
: the input offset distance (used for the mouse; multiplied by factor).factor
: the factor for multiplying offset distance (used for the mouse; defaults to 1).min
: the minimum allowed value (default: no minimum).max
: the maximum allowed value (default: no maximum).mask
: ‘integer’ to apply only to the left of the decimal point; ‘decimal’ to apply only to the right of the decimal point; ‘all’ to apply to the full value (defaults to ‘all’).wrap
: true if the value should be wrapped when it passes min or max; both min and max must be specified (defaults to false).
property-multiply
#
Description:
The property-multiply
command multiplies the value of a property.
Usage:
The property-multiply
command takes the following arguments:
property
: the name of the property to multiply.factor
: the amount by which to multiply (defaults to 1.0).min
: the minimum allowed value (default: no minimum).max
: the maximum allowed value (default: no maximum).mask
: ‘integer’ to apply only to the left of the decimal point; ‘decimal’ to apply only to the right of the decimal point; ‘all’ to apply to the full value (defaults to ‘all’).wrap
: true if the value should be wrapped when it passes min or max; both min and max must be specified (defaults to false).
property-swap
#
Description:
property-scale
#
Description:
property-cycle
#
Description:
dialog-show
#
Description:
dialog-close
#
Description:
dialog-update
#
Description:
dialog-apply
#
Description:
presets-commit - commit preset values from /sim/presets
Attribution
Based on documentation originally created by David Megginson