Skip to main content

msfs.add_observed_simvars()

msfs.add_observed_simvars(def_array)

This function registers SimVars for observing. It triggers the specified events in response to changes in the values of the registered SimVars. In this case, the Event Value corresponds to the SimVar's value.

Note

This function is recommended to be replaced with msfs.mfwasm.add_observed_data(). It becomes possible to access the internal states of MSFS that are not accessible through SimVars, allowing for a more flexible data expression.

Parameters

ParameterTypeDescription
def_arraytableThis parameter specifies the SimVars to be observed as an array of Observed SimVar Definition.

Observed SimVar Definition

KeyTypeDescription
namestringName of SimVar for observing.
This parameter is required.
unitstringUnit of SimVar for observing.
This parameter is required.
eventnumberEvent ID that occurs when the observed SimVar changes.
This parameter is required.
epsilonnumberIf the change in the observed SimVar does not exceed this value, no event will be triggered.
Choosing an appropriate value helps prevent unnecessary event generation, reducing system load.
This parameter is optional. The default is 0.

Return Values

This function doesn't return any value.

See Also