97
edits
m (→property-adjust: Added note about wrap=true) |
m (Corrected formatting) |
||
Line 7: | Line 7: | ||
In other words, '''bindings''' are simply the term for '''actions''' that are associated with certain '''events''' in FlightGear. | In other words, '''bindings''' are simply the term for '''actions''' that are associated with certain '''events''' in FlightGear. | ||
There are different types of events supported by various subsystems, but the resulting action that can be triggered will typically involve either a hard-coded command (a so called fgcommand), or a block of scripted code (using [[Nasal]]). Bindings can be parameterized/customized using properties as arguments that are passed to each binding as a props.Node object. | There are different types of events supported by various subsystems, but the resulting action that can be triggered will typically involve either a hard-coded command (a so called <code>fgcommand</code>), or a block of scripted code (using [[Nasal]]). Bindings can be parameterized / customized using properties as arguments that are passed to each binding as a props.Node object. | ||
And Nasal code can also be registered to become available as a dedicated fgcommand. | And Nasal code can also be registered to become available as a dedicated <code>fgcommand</code>. | ||
An object, button or key can have multiple bindings assigned to them. The bindings will be executed in the order in which they appear in the XML file. Bindings may contain [[conditions]] to make them conditionally executed. Each binding must specify a command node with its particular type, see below. | An object, button or key can have multiple bindings assigned to them. The bindings will be executed in the order in which they appear in the XML file. Bindings may contain [[conditions]] to make them conditionally executed. Each binding must specify a command node with its particular type, see below. | ||
{{Note| | {{Note|Aircraft are free to override key bindings to fullfill their needs. The Space Shuttle for instance has no mixture control, so the m-key switches from translational to rotational hand controller. | ||
The key only performs as mixture control if the plane has mixture settings and if the plane didn't re-assign the key - so dependent on what plane you try, it may or may not. Usually the aircraft-specific help spells it out.<ref>{{cite web | The key only performs as mixture control if the plane has mixture settings and if the plane didn't re-assign the key - so dependent on what plane you try, it may or may not. Usually the aircraft-specific help spells it out.<ref>{{cite web | ||
|url = https://forum.flightgear.org/viewtopic.php?p=298436#p298436 | |url = https://forum.flightgear.org/viewtopic.php?p=298436#p298436 | ||
Line 24: | Line 24: | ||
}} | }} | ||
This article gives a small overview of frequently used bindings. Please refer to {{readme file|commands}} for additional information and refer to $FG_SRC/Main/commands.cxx for a complete list of available bindings. | This article gives a small overview of frequently used bindings. Please refer to {{readme file|commands}} for additional information and refer to <code>$FG_SRC/Main/commands.cxx</code> for a complete list of available bindings. | ||
All given codes are examples, found on various places in the [[FlightGear]] package. | All given codes are examples, found on various places in the [[FlightGear]] package. | ||
Line 31: | Line 31: | ||
Below are some useful commands, some also with their equivalent Nasal call. A more complete listing can be found in the readme file, {{readme file|commands}}. | Below are some useful commands, some also with their equivalent Nasal call. A more complete listing can be found in the readme file, {{readme file|commands}}. | ||
To learn more about adding your own custom fgcommands to the source code, see [[Howto:Add new fgcommands to FlightGear]]. | To learn more about adding your own custom <code>fgcommands</code> to the source code, see [[Howto:Add new fgcommands to FlightGear]]. | ||
=== replay === | === replay === | ||
Line 105: | Line 105: | ||
; max : The maximum allowed value. Defaults to "no maximum." | ; max : The maximum allowed value. Defaults to "no maximum." | ||
; wrap : If true, the value will be wrapped when it passes min or max; both min and max must be present for this to work. Defaults to false.:{{Note|When wrap is set to true, the max parameter must be set to the desired maximum value + step or factor in order to work correctly !}} | ; wrap : If true, the value will be wrapped when it passes min or max; both min and max must be present for this to work. Defaults to false.:{{Note|When wrap is set to true, the max parameter must be set to the desired maximum value + step or factor in order to work correctly !}} | ||
; mask : This argument accepts three value: | ; mask :This argument accepts three value: <code>integer</code>, <code>decimal</code> and <code>all</code> (default). <code>integer</code> means that <code>step</code> or <code>offset * factor</code> is applied to the part of the property's current value left of the decimal point first. <code>decimal</code> does the same, but applies it to the part to the right of the decimal point. <code>all</code> simply applies it to the whole number. This parameter does not seem to affect the resulting new value of the property, and so is not needed. | ||
=== property-assign === | === property-assign === | ||
Line 128: | Line 128: | ||
=== property-cycle === | === property-cycle === | ||
Cycles between a list of values and assigns one to a property. The value-list can vary in length. If the current value is | Cycles between a list of values and assigns one to a property. The value-list can vary in length. If the current value is <code>value1</code>, it will change to <code>value2</code>; if it is <code>value2</code>, it will change to <code>value3</code>, and so on. If the current value is not in the list, it will jump to the first one. | ||
<syntaxhighlight lang="xml"> | <syntaxhighlight lang="xml"> | ||
<binding> | <binding> | ||
Line 138: | Line 138: | ||
</binding> | </binding> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
As of May 2013, the command supports additional behaviours to simplify use with the new [[Knob_/_slider_animation|knob and slider animations]]. The wrapping behaviour can be disabled by setting <wrap>0</wrap>, and the command uses the | As of May 2013, the command supports additional behaviours to simplify use with the new [[Knob_/_slider_animation|knob and slider animations]]. The wrapping behaviour can be disabled by setting <code><wrap>0</wrap></code>, and the command uses the <code>offset</code> argument to select a direction of movement. This means a <code>property-cycle</code> bound to a multi-position knob will function as expected for movement in both directions. | ||
=== property-interpolate === | === property-interpolate === | ||
Line 151: | Line 151: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Instead of using <rate>, one could use <time>, to specify the time (in seconds) it takes to go to the new value, independent of the current value. | Instead of using <code><rate></code>, one could use <code><nowiki><time></nowiki></code><time>, to specify the time (in seconds) it takes to go to the new value, independent of the current value. | ||
<syntaxhighlight lang="xml"> | <syntaxhighlight lang="xml"> | ||
<binding> | <binding> | ||
Line 221: | Line 221: | ||
* '''power:''' the resulting value will be taken to the power of this integer value (overrides squared). | * '''power:''' the resulting value will be taken to the power of this integer value (overrides squared). | ||
Remember: < | Remember: <code>(property ^ power + offset) * factor = result</code> | ||
=== property-swap === | === property-swap === | ||
Line 234: | Line 234: | ||
=== property-toggle === | === property-toggle === | ||
Toggles the value of a property on each click, between true (1) and false (0) | Toggles the value of a property on each click, between <code>true</code> <code>(1</code>) and <code>false</code> (<code>0</code>): | ||
<syntaxhighlight lang="xml"> | <syntaxhighlight lang="xml"> | ||
<binding> | <binding> | ||
Line 241: | Line 241: | ||
</binding> | </binding> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Or - if defined - it toggles between two custom values | Or - if defined - it toggles between two custom values: | ||
<syntaxhighlight lang="xml"> | <syntaxhighlight lang="xml"> | ||
<binding> | <binding> |
edits