Bindings: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(Created page with ''''Bindings''' define what happens when a user: * clicks an object in the scenery or an aircraft * press a key on the keyboard or […')
 
m (Robot: Cosmetic changes)
Line 1: Line 1:
'''Bindings''' define what happens when a user:
'''Bindings''' define what happens when a user:
* [[Howto:_Make_a_clickable_panel#Pick|clicks an object]] in the [[scenery]] or an [[aircraft]]
* [[Howto: Make a clickable panel#Pick|clicks an object]] in the [[scenery]] or an [[aircraft]]
* press a key on the keyboard or [[joystick]]
* press a key on the keyboard or [[joystick]]
* clicks a [[menu]] item
* clicks a [[menu]] item
Line 8: Line 8:
All give codes are examples, found on various places in the [[FlightGear]] package.
All give codes are examples, found on various places in the [[FlightGear]] package.


==Commands==
== Commands ==
===dialog-show===
=== dialog-show ===
Shows a dialog, which should be present in <tt>[[$FG_ROOT]]/gui/Dialogs</tt>.  
Shows a dialog, which should be present in <tt>[[$FG ROOT]]/gui/Dialogs</tt>.  
  <binding>
  <binding>
   <command>dialog-show</command>
   <command>dialog-show</command>
Line 17: Line 17:
* '''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>
  <binding>
Line 24: Line 24:
  </binding>
  </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>
  <binding>
Line 34: Line 34:
  </binding>
  </binding>


===property-cycle===
=== property-cycle ===
Cycles between a list of values and assigns one to a property. The value-list can vary in length.
Cycles between a list of values and assigns one to a property. The value-list can vary in length.
  <binding>
  <binding>
Line 44: Line 44:
  </binding>
  </binding>


===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>
  <binding>
Line 53: Line 53:
  </binding>
  </binding>


===property-set===
=== property-set ===
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>
  <binding>
Line 61: Line 61:
  </binding>
  </binding>


===property-swap===
=== property-swap ===
Swaps the values of two properties.
Swaps the values of two properties.
  <binding>
  <binding>
Line 69: Line 69:
  </binding>
  </binding>


===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>
  <binding>

Revision as of 20:55, 30 November 2010

Bindings define what happens when a user:

You can assign multiple bindings to one object/button/key.

All give codes are examples, found on various places in the FlightGear package.

Commands

dialog-show

Shows a dialog, which should be present in $FG ROOT/gui/Dialogs.

<binding>
 <command>dialog-show</command>
 <dialog-name>location-in-air</dialog-name>
</binding>
  • dialog-name: the name of the dialog, as designated in its .xml file.

nasal

Nasal is frequently used for complicated systems.

<binding>
 <command>nasal</command>
 <script>b777.afds.input(0,1);</script>
</binding>

property-adjust

Increases or decreases a property's value with a given step. Maximum and minimum values are optional.

<binding>
 <command>property-adjust</command>
 <property>/controls/lighting/panel-norm</property>
 <step>-0.05</step>
 <min>0</min>
 <max>1</max>
</binding>

property-cycle

Cycles between a list of values and assigns one to a property. The value-list can vary in length.

<binding>
 <command>property-cycle</command>
 <property>/autopilot/autobrake/setting</property>
 <value type="string">ARM</value>
 <value type="string">DISARM</value>
 <value type="string">OFF</value>
</binding>

property-randomize

Assigns a random value (between min and max) to a property.

<binding>
 <command>property-randomize</command>
 <property>/orientation/pitch-deg</property>
 <min>0</min>
 <max>360</max>
</binding>

property-set

One of the most important commands. It sets a property to a predefined value.

<binding>
 <command>property-set</command>
 <property>/autopilot/settings/target-speed-kt</property>
 <value>0</value>
</binding>

property-swap

Swaps the values of two properties.

<binding>
 <command>property-swap</command>
 <property>/instrumentation/comm/frequencies/selected-mhz</property>
 <property>/instrumentation/comm/frequencies/standby-mhz</property>
</binding>

property-toggle

Toggles the value of a property on each click, between true (1) and false (0).

<binding>
 <command>property-toggle</command>
 <property>/controls/gear/gear-down</property>
</binding>

Or if defined it toggles between two values.

<binding>
 <command>property-toggle</command>
 <property>/controls/gear/gear-down</property>
 <value>2</value>
 <value>3</value>
</binding>