Difference between revisions of "Xpl command"
Jump to navigation
Jump to search
(Commands) |
|||
Line 20: | Line 20: | ||
| 1 || '''commandref''' || ''String'' || Reference to a command from X-plane (see [http://siminnovations.com/xplane/command/index.php here]) | | 1 || '''commandref''' || ''String'' || Reference to a command from X-plane (see [http://siminnovations.com/xplane/command/index.php here]) | ||
|- | |- | ||
| 2 || '''value''' || ''Number'' || Optional field. | | 2 || '''value''' || ''Number'' || Optional field. From AM/AP 4.1, you can set this argument to "BEGIN", "ONCE" or "END" command. Older versions can use provide 1 for a BEGIN command, or 0 for an END command. | ||
|- | |- | ||
|} | |} | ||
Line 36: | Line 36: | ||
function button_pressed() | function button_pressed() | ||
-- Engage starter motor | -- Engage starter motor | ||
xpl_command("sim/engines/engage_starters", | xpl_command("sim/engines/engage_starters", "BEGIN") | ||
end | end | ||
function button_released() | function button_released() | ||
-- Disengage starter motor | -- Disengage starter motor | ||
xpl_command("sim/engines/engage_starters", | xpl_command("sim/engines/engage_starters", "END") | ||
end | end | ||
</source > | </source > |
Revision as of 09:59, 6 August 2021
Description
xpl_command(commandref)
xpl_command is used to send a command to X-plane
X-plane uses commandrefs, these may be used to send commands to X-Plane. You can find the list of available commands here.
Return value
This function won't return any value.
Arguments
# | Argument | Type | Description |
---|---|---|---|
1 | commandref | String | Reference to a command from X-plane (see here) |
2 | value | Number | Optional field. From AM/AP 4.1, you can set this argument to "BEGIN", "ONCE" or "END" command. Older versions can use provide 1 for a BEGIN command, or 0 for an END command. |
Example
-- Shut down X-plane
xpl_command("sim/operation/quit")
-- Only use the begin and end commands when necessary
function button_pressed()
-- Engage starter motor
xpl_command("sim/engines/engage_starters", "BEGIN")
end
function button_released()
-- Disengage starter motor
xpl_command("sim/engines/engage_starters", "END")
end