Object: Dataref

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:

All datarefs can be read; they may also optionally be writable.

Properties

Methods

Events

Listen to these events using simulator.addEventListener(). Remove your listener using simulator.removeEventListener().

Example

> dataref = simulator.findDataref("laminar/c172/fuel/fuel_tank_selector")
Dataref{ name: "laminar/c172/fuel/fuel_tank_selector" }
> dataref.value = 1;
undefined
> dataref = simulator.findDataref("sim/version/xplane_internal_version")
Dataref{ name: "sim/version/xplane_internal_version" }
> dataref.set(121000)
Uncaught Error: Not writable

References