VARS API
The Microsoft Flight Simulator 2024 Event API permits you to manage simulation variablesusing WebAssembly. This API is designed to replace the features provided by the deprecated Gauge API.
The functions available for this API are as follows:
Function | Description |
---|---|
fsVarsGetUnitId |
Get the Id of a specific unit. |
fsVarsGetAircraftVarId |
Get the Id of a specific SimVar. |
fsVarsAircraftVarGet |
Get the value of a specific SimVar. |
fsVarsAircraftVarSet |
Set the value of a specific SimVar. |
fsVarsRegisterNamedVar |
Create a new NamedVar. |
fsVarsGetRegisteredNamedVarId |
Get the Id of a named variable |
fsVarsNamedVarGet |
Get the value of a specific NamedVar. |
fsVarsNamedVarSet |
Set the value of a specific NamedVar. |
fsVarsRegisterCustomSimVar |
Create a new CustomSimVar. |
fsVarsCustomSimdVarGet |
Get the value of a specific CustomSimVar. |
fsVarsCustomSimVarSet |
Set the value of a specific CustomSimVar. |
You can find a sample project to use as a reference when using the Event API here:
- COMING SOON!
Typedefs
When using this API the following typedefs exist to help:
FsSimVarId
The ID of a SimVar.
typedef int FsSimVarId;
FsNamedVarId
The ID of a named variable (or L:Var).
typedef int FsNamedVarId;
FsUnitId
The ID of a Unit used by simulation variables.
typedef int FsUnitId;
FsCustomSimVarId
The ID of a custom SimVar. It regroups O
, I
and L
variables.
typedef int FsCustomSimVarId;
FsVarError
The ID of errors linked to this API.
typedef unsigned int FsVarError;
sFsSimCustomSimVarScope
Defines the scope of a custom SimVar, where:
enum sFsSimCustomSimVarScope : unsigned char
{
FsSimCustomSimVarScopeSim,
FsSimCustomSimVarScopeComponent,
FsSimCustomSimVarScopeHierarchy
};
FsSimCustomSimVarScopeSim
: the Custom SimVar is local to the SimObject.FsSimCustomSimVarScopeComponent
: the Custom SimVar is local to a component.FsSimCustomSimVarScopeHierarchy
: the Custom SimVar is local to a component and its hierarchy.