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:

 

  • typedef int FsSimVarId;
    FsSimVarId: the ID of a SimVar.
  • typedef int FsNamedVarId;
    FsNamedVarId: the ID of a NamedVar (or L:Var).
  • typedef int FsUnitId;
    FsUnitId: the ID of an Unit used by simulation variables.
  • typedef int FsCustomSimVarId;
    FsCustomSimVarId: the ID of a Custom SimVar. It regroups O:Var, I:Var and L:1:Var.
  • typedef unsigned int FsVarError;
    FsVarError: the ID of errors linked to this API.
  • enum sFsSimCustomSimVarScope : unsigned char
    {
        FsSimCustomSimVarScopeSim,
        FsSimCustomSimVarScopeComponent,
        FsSimCustomSimVarScopeHierarchy
    };
    eFsSimCustomSimVarScope: defines the scope fo a Custom SimVar
    • 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.