Bindings: Difference between revisions

Jump to navigation Jump to search
377 bytes added ,  10 September 2013
m
<syntaxhighlight>
m (Reverted edits by Hooray (talk) to last revision by Gijs)
m (<syntaxhighlight>)
Line 20: Line 20:
=== dialog-close ===
=== dialog-close ===
Closes the active dialog.
Closes the active dialog.
<binding>
<syntaxhighlight>
  <command>dialog-close</command>
<binding>
</binding>
<command>dialog-close</command>
</binding>
</syntaxhighlight>


=== dialog-show ===
=== dialog-show ===
Shows a dialog, which should be present in <tt>[[$FG ROOT]]/gui/dialogs</tt>. Starting with FlightGear 2.7 dialog files located in <tt><Current aircraft directory>/gui/dialogs</tt> are also loaded. This should be used for dialogs specific to a certain aircraft.
Shows a dialog, which should be present in <tt>[[$FG ROOT]]/gui/dialogs</tt>. Starting with FlightGear 2.7 dialog files located in <tt><Current aircraft directory>/gui/dialogs</tt> are also loaded. This should be used for dialogs specific to a certain aircraft.
<binding>
<syntaxhighlight>
  <command>dialog-show</command>
<binding>
  <dialog-name>location-in-air</dialog-name>
<command>dialog-show</command>
</binding>
<dialog-name>location-in-air</dialog-name>
</binding>
</syntaxhighlight>
* '''dialog-name:''' the name of the dialog, as designated in its .xml file.
* '''dialog-name:''' the name of the dialog, as designated in its .xml file.


=== nasal ===
=== nasal ===
[[Nasal]] is frequently used for complicated systems.
[[Nasal]] is frequently used for complicated systems.
<binding>
<syntaxhighlight>
  <command>nasal</command>
<binding>
  <script>b777.afds.input(0,1);</script>
<command>nasal</command>
</binding>
<script>b777.afds.input(0,1);</script>
</binding>
</syntaxhighlight>
The cmadarg() function is often useful in these situations to extract offset values passed to the binding.
The cmadarg() function is often useful in these situations to extract offset values passed to the binding.


=== property-adjust ===
=== property-adjust ===
Increases or decreases a property's value with a given step. Maximum and minimum values are optional.
Increases or decreases a property's value with a given step. Maximum and minimum values are optional.
<binding>
<syntaxhighlight>
  <command>property-adjust</command>
<binding>
  <property>/controls/lighting/panel-norm</property>
<command>property-adjust</command>
  <step>-0.05</step>
<property>/controls/lighting/panel-norm</property>
  <min>0</min>
<step>-0.05</step>
  <max>1</max>
<min>0</min>
</binding>
<max>1</max>
</binding>
</syntaxhighlight>


=== property-assign ===
=== property-assign ===
One of the most important commands. It sets a property to a predefined value.
One of the most important commands. It sets a property to a predefined value.
<binding>
<syntaxhighlight>
  <command>property-assign</command>
<binding>
  <property>/autopilot/settings/target-speed-kt</property>
<command>property-assign</command>
  <value>0</value>
<property>/autopilot/settings/target-speed-kt</property>
</binding>
<value>0</value>
</binding>
</syntaxhighlight>


=== 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 "value1", it will change to "value2"; if it is "value2", it will change to "value3", and so on, wrapping around the end.  If the current value is not in the list, it will jump to the first one.
Cycles between a list of values and assigns one to a property. The value-list can vary in length. If the current value is "value1", it will change to "value2"; if it is "value2", it will change to "value3", and so on, wrapping around the end.  If the current value is not in the list, it will jump to the first one.
<binding>
<syntaxhighlight>
  <command>property-cycle</command>
<binding>
  <property>/autopilot/autobrake/setting</property>
<command>property-cycle</command>
  <value type="string">ARM</value>
<property>/autopilot/autobrake/setting</property>
  <value type="string">DISARM</value>
<value type="string">ARM</value>
  <value type="string">OFF</value>
<value type="string">DISARM</value>
</binding>
<value type="string">OFF</value>
</binding>
</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 'offset' argument to select a direction of movement. This means a property-cycle bound to a multi-position knob will function as expected for movement in both directions.
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 'offset' argument to select a direction of movement. This means a property-cycle bound to a multi-position knob will function as expected for movement in both directions.


Line 102: Line 114:
=== property-multiply ===
=== property-multiply ===
Multiply the value of a property by a given factor.
Multiply the value of a property by a given factor.
<binding>
<syntaxhighlight>
  <command>property-multiply</command>
<binding>
  <property>/controls/flight/aileron</property>
<command>property-multiply</command>
  <factor>0.5</factor>
<property>/controls/flight/aileron</property>
  <min>-1</min>
<factor>0.5</factor>
  <max>1</max>
<min>-1</min>
  <mask>all</mask>
<max>1</max>
  <wrap>true</wrap>
<mask>all</mask>
</binding>
<wrap>true</wrap>
</binding>
</syntaxhighlight>
*'''factor:''' the amount to multiply by.
*'''factor:''' the amount to multiply by.
*'''min:''' minimum value.
*'''min:''' minimum value.
Line 122: Line 136:
=== property-randomize ===
=== property-randomize ===
Assigns a random value (between min and max) to a property.
Assigns a random value (between min and max) to a property.
<binding>
<syntaxhighlight>
  <command>property-randomize</command>
<binding>
  <property>/orientation/pitch-deg</property>
<command>property-randomize</command>
  <min>0</min>
<property>/orientation/pitch-deg</property>
  <max>360</max>
<min>0</min>
</binding>
<max>360</max>
</binding>
</syntaxhighlight>


=== property-scale ===
=== property-scale ===
Set the value of a property based on an axis, often used in [[joystick]] configuration files.
Set the value of a property based on an axis, often used in [[joystick]] configuration files.
<binding>
<syntaxhighlight>
  <command>property-scale</command>
<binding>
  <property>/controls/flight/aileron</property>
<command>property-scale</command>
  <offset>0.001</offset>
<property>/controls/flight/aileron</property>
  <factor>-1</factor>
<offset>0.001</offset>
  <power>3</power>
<factor>-1</factor>
</binding>
<power>3</power>
</binding>
</syntaxhighlight>


* '''offset:''' the offset to shift by, before applying the factor.
* '''offset:''' the offset to shift by, before applying the factor.
Line 148: Line 166:
=== property-swap ===
=== property-swap ===
Swaps the values of two properties, useful for radio panels.
Swaps the values of two properties, useful for radio panels.
<binding>
<syntaxhighlight>
  <command>property-swap</command>
<binding>
  <property>/instrumentation/comm/frequencies/selected-mhz</property>
<command>property-swap</command>
  <property>/instrumentation/comm/frequencies/standby-mhz</property>
<property>/instrumentation/comm/frequencies/selected-mhz</property>
</binding>
<property>/instrumentation/comm/frequencies/standby-mhz</property>
</binding>
</syntaxhighlight>


=== 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 true (1) and false (0).
<binding>
<syntaxhighlight>
  <command>property-toggle</command>
<binding>
  <property>/controls/gear/gear-down</property>
<command>property-toggle</command>
</binding>
<property>/controls/gear/gear-down</property>
</binding>
</syntaxhighlight>
Or - if defined - it toggles between two custom values.
Or - if defined - it toggles between two custom values.
<binding>
<syntaxhighlight>
  <command>property-toggle</command>
<binding>
  <property>/controls/gear/gear-down</property>
<command>property-toggle</command>
  <value>2</value>
<property>/controls/gear/gear-down</property>
  <value>3</value>
<value>2</value>
</binding>
<value>3</value>
</binding>
</syntaxhighlight>


===request-metar ===
===request-metar ===
395

edits

Navigation menu