- Datarefs are information.
- Commands are actions.
A dataref is a single bit of published information. For example, the user's indicated airspeed, as seen by the pilot, is a dataref, stored in:
You can always read a dataref, but sometimes you can change it. Trying to change a dataref usually has one of three actions:
A command is an action that the sim can take on your behalf. For example, the command
Like datarefs, commands have permanent names, starting with sim/ for X-Plane or other prefixes for plugins. Commands have been available in X-Plane since version 9.0.
You can always actuate a command, but there is no guarantee that it will do anything. For example, the engine starter command won't start the engine if the plane has electrical starters and the battery is dead.
You can use commands by:
Plugins can add both new datarefs and new commands to the sim. Plugins can also change the behavior of all built-in sim commands, and can change the information in some datarefs.
Where Do I Find Datarefs And Commands
X-Plane's default commands and datarefs are listed in the text files Commands.txt and Datarefs.txt in the Resources/plugins folder. (Note: providing the command list is new to X-Plane 930.) The dataref list is also available on the X-Plane SDK Wiki.
Datarefs have names that do not change. Datarefs made available by X-Plane start with sim/ while datarefs made available by plugins start with another prefix. Datarefs have been in X-Plane since the release of the plugin system in version 6.70.sim/cockpit2/gauges/indicators/airspeed_kts_pilot
You can always read a dataref, but sometimes you can change it. Trying to change a dataref usually has one of three actions:
- If the dataref is not writable at all, nothing happens.
- If the dataref is writable, it will change.
- Sometimes a dataref may be writable, but only after changing some other sim configuration. For example, you can only "write" to the control surface deflection datarefs after setting the control surface override dataref to 1. (If you don't set this override, X-Plane will constantly write its own ideas of the control surface positions to the control surface datarefs and your changes will be lost.)
- With the DataRefEditor plugin (if you just need to find some information).
- Via generic instruments.
- Via OBJ8 animations and manipulators.
- Via a plugin via the XPLMDataAccess APIs.
A command is an action that the sim can take on your behalf. For example, the command
arms the autopilot for altitude hold.sim/autopilot/altitude_arm
Like datarefs, commands have permanent names, starting with sim/ for X-Plane or other prefixes for plugins. Commands have been available in X-Plane since version 9.0.
You can always actuate a command, but there is no guarantee that it will do anything. For example, the engine starter command won't start the engine if the plane has electrical starters and the battery is dead.
You can use commands by:
- Binding them to your joystick and keyboard, in the joystick settings dialog box.
- Using a generic trigger instrument.
- Using a manipulator in an OBJ.
- Using the XPLMUtilties APIs - these are SDK 2.0 features.
Plugins can add both new datarefs and new commands to the sim. Plugins can also change the behavior of all built-in sim commands, and can change the information in some datarefs.
Where Do I Find Datarefs And Commands
X-Plane's default commands and datarefs are listed in the text files Commands.txt and Datarefs.txt in the Resources/plugins folder. (Note: providing the command list is new to X-Plane 930.) The dataref list is also available on the X-Plane SDK Wiki.
Up next: when should I use a command and when should I use a dataref?
No comments:
Post a Comment