The Dataref object represents a single dataref in the simulator. This object can be used to read and write the dataref's value, as well as learn about it's type.
Dataref objects can be found using simulator.findDataref() or simulator.createDataref().
Datarefs are of one or more types in X-Plane; Jetscript coerces the 6 possible types from the C API down into 3 options:
number types represent int, float and double valuesarray types represent int array and float array valuesstring type datarefs represent the byte-array valuesAll datarefs can be read; they may also optionally be writable.
Dataref.value is the current value of the dataref.Dataref.type is the data type of this dataref (number/string/array).Dataref.writable indicates if this dataref is writable.Dataref.owner is the plugin that created this dataref, and provides the value.Dataref.get() reads the value of this dataref.Dataref.set() sets the value of this dataref.Listen to these events using simulator.addEventListener(). Remove your listener using simulator.removeEventListener().
valuechange is fired when the value of this dataref changes.> dataref = "laminar/c172/fuel/fuel_tank_selector"
Dataref
> dataref.value = 1;
undefined
> dataref = "sim/version/xplane_internal_version"
Dataref
> 121000
Uncaught Error: Not writable