Dataref vs. Command: Know Your Copilots
Okay, aviatorâbefore we start wiring buttons to things like flaps, lights, ejector seats (hey, no judgment), we need to understand the two main languages X-Plane speaks: Datarefs and Commands.
Think of these like your cockpit crew. One tells you whatâs going on. The other makes things happen.
đ§ Datarefs: The Sim Whisperers
Datarefs are like the gauges and readouts in your cockpit. They tell you the current state of something in the sim. Theyâre informational. Want to know if the landing gear is down? Thereâs a dataref for that. Want to see your fuel level? Yepâdataref.
They're like saying: đť âHey sim, whatâs the current altitude of this bird?â And the sim replies: đŠď¸ âYouâre at 2,700 feet, boss.â
You read datarefs to get info. Some can be written to (weâll get to that), but they donât do anything on their own.
âď¸
Example:
sim/cockpit2/switches/landing_lights_on = 1
(This tells you the landing lights are on. Maybe. Sometimes. Depending on the aircraft. Yay, X-Plane!)
đď¸ Commands: The Doers
Commands are the simâs action-takers. They make something happenâlike flipping a switch, toggling a light, or yelling âCLEAR PROP!â before engine start (okay, maybe not that last one⌠yet).
Theyâre like saying: đď¸ âHey sim, turn on the landing lights.â And the sim does itâno questions asked.
You donât get a value back, you just send the command and hope the sim complies. (Most of the time, it does. Sometimes it acts like a teenager.)
âď¸
Example:
sim/lights/landing_lights_toggle
(This tells the sim: âToggle the landing lights!â)
So... Which One Do I Use?
â Use a command when you want to make something happen. (Buttons, switches, momentary events)
â Use a dataref when you want to check the state of something. (LEDs, displays, conditions)
â Sometimes, use both if you want to change something and confirm it worked.
𧊠Bonus Tip: Not All Aircraft Play Nice
Some aircraft (especially custom ones) love using their own secret datarefs and commands. So if your button doesnât seem to be doing anything, you may need to do a little detective work using DataRefTool to figure out whatâs actually going on under the hood.
That's it! You've just passed the "Datarefs vs. Commands" ground school exam. No written test required, but feel free to celebrate with a smug throttle push.
Last updated
Was this helpful?