2,733
edits
Red Leader (talk | contribs) (Begin cleanup) |
Red Leader (talk | contribs) (Some more cleanup) |
||
Line 11: | Line 11: | ||
== Commands == | == Commands == | ||
Below are a number of useful commands. | Below are a number of useful commands, some also with their equivalent Nasal call. For the complete list, see {{flightgear file|src/Main/fg_commands.cxx|l=1425}}. | ||
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 fgcommands to the source code, see [[Howto:Add new fgcommands to FlightGear]]. | ||
=== dialog-close === | === dialog-close === | ||
Line 21: | Line 21: | ||
<command>dialog-close</command> | <command>dialog-close</command> | ||
</binding> | </binding> | ||
</syntaxhighlight> | |||
<syntaxhighlight lang="nasal"> | |||
fgcommand("dialog-close"); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
=== 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>. In addition, from FlightGear 2.8, dialog files located in <tt>''<aircraft directory>/gui/dialogs''</tt> are also loaded. This should be used for dialogs specific to a certain aircraft. | ||
<syntaxhighlight lang="xml"> | <syntaxhighlight lang="xml"> | ||
<binding> | <binding> | ||
Line 31: | Line 34: | ||
</binding> | </binding> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<syntaxhighlight lang="nasal"> | |||
fgcommand("dialog-show", props.Node.new({"dialog-name": "location-in-air"})); | |||
</syntaxhighlight> | |||
; dialog-name : The name of the dialog, as designated in its XML file. | |||
=== nasal === | === nasal === | ||
Line 41: | Line 48: | ||
</binding> | </binding> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
; script : The Nasal script to execute. | |||
: {{inote|Make sure that the script does not conflict with the {{wikipedia|List of XML and HTML character entity references#Predefined entities in XML|predefined XML entities}}. If it does, you can either put it in a {{wikipedia|CDATA|CDATA section}} or use a non-interpreted version (e.g., <code>&gt;</code> in place of <code>></code>).}} | |||
The {{func link|cmdarg}} function is often useful in these situations to extract offset values passed to the binding. It returns the specific <tt><binding></tt> node, which contains a <tt><setting></tt> node at runtime if used in a joystick axis that represents the value of that axis. | The {{func link|cmdarg}} function is often useful in these situations to extract offset values passed to the binding. It returns the specific <tt><binding></tt> node, which contains a <tt><setting></tt> node at runtime if used in a joystick axis that represents the value of that axis. | ||
In joysticks and keyboard keys the script is run in a specific namespace; please | In joysticks and keyboard keys, the script is run in a specific namespace; please see [[Howto:Understand Namespaces and Methods]] for more information on namespaces. | ||
=== property-adjust === | === property-adjust === |