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
Parameter | Type | Description |
---|---|---|
def_array | table | This parameter specifies the SimVars to be observed as an array of Observed SimVar Definition. |
Observed SimVar Definition
Key | Type | Description |
---|---|---|
name | string | Name of SimVar for observing. This parameter is required. |
unit | string | Unit of SimVar for observing. This parameter is required. |
event | number | Event ID that occurs when the observed SimVar changes. This parameter is required. |
epsilon | number | If 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.