Fires an X-Plane command once, or begins and ends a held command.
Parameters
#
Name
Type
Description
1
commandref
String
Reference to a command from X-Plane (see here)
2
value
Number
Optional field. From AM/, you can set this argument to 'BEGIN', 'ONCE' or 'END' command. Older versions can use provide 1 for a BEGIN command, or 0 for an END command.
Subscribes to one dataref, or several dataref and type pairs. The callback receives the values in that order.
Parameters
#
Name
Type
Description
1 .. n
variable
String
Reference to a dataref from X-Plane (see X-Plane DataRefs)
2 .. n
unit
String
Data type of the DataRef, can be INT,FLOAT,DOUBLE,INT[n],FLOAT[n],DOUBLE[n], BYTE[n] or STRING
last
callback_function
Function
The function to call when new data is available
Example
-- One dataref, or several pairs. Values arrive in that order.xpl_dataref_subscribe(
"sim/cockpit2/gauges/indicators/altitude_ft_pilot", "FLOAT",
"sim/cockpit2/gauges/indicators/airspeed_kts_pilot", "FLOAT",
function(alt_ft, ias)
txt_set(alt, tostring(math.floor(alt_ft)))
rotate(needle, ias * 2)
end)
Example: one value, and a pair
xpl_dataref_subscribe("sim/cockpit2/gauges/indicators/altitude_ft_pilot", "FLOAT", function(ft)
txt_set(alt, tostring(math.floor(ft)))
end)
-- Both arrive together, in this orderxpl_dataref_subscribe(
"sim/cockpit2/gauges/indicators/altitude_ft_pilot", "FLOAT",
"sim/cockpit2/gauges/indicators/airspeed_kts_pilot", "FLOAT",
function(ft, kts)
txt_set(alt, tostring(math.floor(ft)))
txt_set(ias, tostring(math.floor(kts)))
end)
A simulator call. Connection, variables, and events for that sim.
Parameters
#
Name
Type
Description
1
event
String
Reference to an event from Flight Simulator 2020/2024. Use 'H:' prefix for H events, see example below.
2
value_1
Number
(Optional) Send a value with the event. Some events support setting a value.
3
value_2
Number
(Optional) Send a value with the event. Some events support setting a value.
Example
-- Simulator value, not a panel valuemsfs_event("INDICATED ALTITUDE", "Feet")
Photo slot: shots/msfs_event.png
msfs_event_subscribe
Simulation Instrument Studio 1
Overloads
msfs_event_subscribe(event, callback)
A simulator call. Connection, variables, and events for that sim.
Parameters
#
Name
Type
Description
1
event
String
Reference to the FS2020/FS2024 event
2
callback
Function
The function to call when a new event has been sent within the sim
Example
-- Simulator value, not a panel valuemsfs_event_subscribe("INDICATED ALTITUDE", "Feet")
Photo slot: shots/msfs_event_subscribe.png
msfs_rpn
Simulation Instrument Studio 1
Overloads
msfs_rpn(rpn_script, callback)
A simulator call. Connection, variables, and events for that sim.
Parameters
#
Name
Type
Description
1
rpn_script
String
The RPN script to execute within FS2020/FS2024.
2
callback
Function
(Optional) Return value from the executed RPN script. Three arguments are given, first is integer, second is float and third is string. Note that these arguments are nil when script could not be executed. Make sure to nil check in your callback.
Example
-- Simulator value, not a panel valuemsfs_rpn("INDICATED ALTITUDE", "Feet")
Photo slot: shots/msfs_rpn.png
msfs_variable_subscribe
Simulation Instrument Studio 1
Overloads
msfs_variable_subscribe(variable, unit, callback_function)
A simulator call. Connection, variables, and events for that sim.
Parameters
#
Name
Type
Description
1 .. n
variable
String
Reference to a variable from Flight Simulator 2020/2024. Use prefix 'L:' for LVARS, see example below
2 .. n
unit
String
Unit of the variable, can be found with the variable. Different units can be used for different variables. For example Hours, Knots and RPM
A simulator call. Connection, variables, and events for that sim.
Parameters
#
Name
Type
Description
1
event
String
Reference to an event from Flight Simulator 2020. Use 'H:' prefix for H events, see example below.
2
type
String
(Optional) Data type, can be INT, FLOAT, DOUBLE, BOOL or STRING.
3
value
Number
(Optional) Send a value with the event. Some events support setting a value.
4
value_2
Number
(Optional) Send a value with the event. Some events support setting a value.
Example
-- Simulator value, not a panel valuefs2020_event("INDICATED ALTITUDE", "Feet")
Photo slot: shots/fs2020_event.png
fs2020_event_subscribe
Simulation Instrument Studio 1
Overloads
fs2020_event_subscribe(event, callback)
A simulator call. Connection, variables, and events for that sim.
Parameters
#
Name
Type
Description
1
event
String
Reference to the FS2020 event
2
callback
Function
The function to call when a new event has been sent within FS2020
Example
-- Simulator value, not a panel valuefs2020_event_subscribe("INDICATED ALTITUDE", "Feet")
Photo slot: shots/fs2020_event_subscribe.png
fs2020_rpn
Simulation Instrument Studio 1
Overloads
fs2020_rpn(rpn_script, callback)
A simulator call. Connection, variables, and events for that sim.
Parameters
#
Name
Type
Description
1
rpn_script
String
The RPN script to execute within FS2020.
2
callback
Function
(Optional) Return value from the executed RPN script. Three arguments are given, first is integer, second is float and third is string. Note that these arguments are nil when script could not be executed. Make sure to nil check in your callback.
Example
-- Simulator value, not a panel valuefs2020_rpn("INDICATED ALTITUDE", "Feet")
Photo slot: shots/fs2020_rpn.png
fs2020_variable_subscribe
Simulation Instrument Studio 1
Overloads
fs2020_variable_subscribe(variable, unit, callback_function)
A simulator call. Connection, variables, and events for that sim.
Parameters
#
Name
Type
Description
1 .. n
variable
String
Reference to a variable from Flight Simulator 2020. Use prefix 'L:' for LVARS, see example below
2 .. n
unit
String
Unit of the variable, can be found with the variable. Different units can be used for different variables. For example Hours, Knots and RPM
A simulator call. Connection, variables, and events for that sim.
Parameters
#
Name
Type
Description
1
event
String
Reference to an event from Flight Simulator 2020. Use 'H:' prefix for H events, see example below.
2
type
String
(Optional) Data type, can be INT, FLOAT, DOUBLE, BOOL or STRING.
3
value
Number
(Optional) Send a value with the event. Some events support setting a value.
4
value_2
Number
(Optional) Send a value with the event. Some events support setting a value.
Example
-- Simulator value, not a panel valuefs2024_event("INDICATED ALTITUDE", "Feet")
Photo slot: shots/fs2024_event.png
fs2024_event_subscribe
Simulation Instrument Studio 1
Overloads
fs2024_event_subscribe(event, callback)
A simulator call. Connection, variables, and events for that sim.
Parameters
#
Name
Type
Description
1
event
String
Reference to the FS2024 event
2
callback
Function
The function to call when a new event has been sent within FS2024
Example
-- Simulator value, not a panel valuefs2024_event_subscribe("INDICATED ALTITUDE", "Feet")
Photo slot: shots/fs2024_event_subscribe.png
fs2024_rpn
Simulation Instrument Studio 1
Overloads
fs2024_rpn(rpn_script, callback)
A simulator call. Connection, variables, and events for that sim.
Parameters
#
Name
Type
Description
1
rpn_script
String
The RPN script to execute within FS2024.
2
callback
Function
(Optional) Return value from the executed RPN script. Three arguments are given, first is integer, second is float and third is string. Note that these arguments are nil when script could not be executed. Make sure to nil check in your callback.
Example
-- Simulator value, not a panel valuefs2024_rpn("INDICATED ALTITUDE", "Feet")
Photo slot: shots/fs2024_rpn.png
fs2024_variable_subscribe
Simulation Instrument Studio 1
Overloads
fs2024_variable_subscribe(variable, unit, callback_function)
A simulator call. Connection, variables, and events for that sim.
Parameters
#
Name
Type
Description
1 .. n
variable
String
Reference to a variable from Flight Simulator 2024. Use prefix 'L:' for LVARS, see example below
2 .. n
unit
String
Unit of the variable, can be found with the variable. Different units can be used for different variables. For example Hours, Knots and RPM
fsx_variable_subscribe(variable, unit, callback_function)
A simulator call. Connection, variables, and events for that sim.
Parameters
#
Name
Type
Description
1 .. n
variable
String
Reference to a variable from Flight Simulator X or Prepar3D
2 .. n
unit
String
Unit of the variable, can be found with the variable. Different units can be used for different variables. For example Hours, Knots and RPM (look here for FSX units and here for Prepar3D)