Skip to content

Sim variables/events

Read simulator and local variables, and write variables or events, from Flow Pro scripts.

Updated View as Markdown
For humans
Flow APIFlow Pro scriptingSimulator data

This article covers the following platforms

Read simulator and local variables, and write simulator variables, local variables, or events.

get()

Read a simulator or local variable in a requested unit.

SignatureTypeScript contract
get(var_name: string, unit: string): unknown

Parameters

NameTypeRequiredDescription
var_namestringYesName of the variable to read.
unitstringYesUnit in which to read the variable.
ExampleJavaScript
const parkingBrake = this.$api.variables.get(
  "A:BRAKE PARKING POSITION",
  "bool"
);

const tentSwitch = this.$api.variables.get(
  "L:P42_FF_SWITCH_TENT",
  "number"
);

Returns

unknownCurrent value of the requested variable in the requested unit.

set()

Write a simulator variable, local variable, or event.

SignatureTypeScript contract
set(var_name: string, unit: string, value: number): void

Parameters

NameTypeRequiredDescription
var_namestringYesName of the variable or event to write.
unitstringYesUnit of the value being written.
valuenumberYesValue to write.
ExampleJavaScript
this.$api.variables.set("A:LIGHT LANDING", "bool", 1);
this.$api.variables.set("L:P42_FF_SWITCH_TENT", "number", 1);
this.$api.variables.set("K:PARKING_BRAKE_SET", "bool", 1);

Returns

voidNo direct return value is documented.
Navigation

Type to search…

↑↓ navigate↵ selectEsc close