fsVarsAircrafVarSet

The fsVarsAircraftVarSet function can be used to set the value of a specific SimVar.

 

Syntax
FsVarError fsVarsAircraftVarSet(
    FsSimVarId simvarId,
    FsUnitId unitId,
    FsVarParamArray param,
    double value
);

 

Parameters
Parameters Description
simvarId

The id of a simvar (found using fsVarsGetAircraftVarId).

unitId The id of an unit (found using fsVarsGetUnitId).
param The parameter which might be mandatory to access the simvar (in case of an indexed simvar for instance). Elements in param can be FsCrc, String or index.
value The new value of the simvar.

Return Values

The function returns a FsVarError, 0 means there is no error.

 

Example
FsUnitId unitId = fsVarsGetUnitId("DEGREES");
FsSimVarId simvarId = fsVarsGetAircraftVarId("ATTITUDE INDICATOR PITCH DEGREES");
FsVarParamArray param = FsCreateParamArray("i", 0);
double newValue = 123;
if (fsVarsAircraftVarSet(simvarId, unitId, param, newValue) == FS_VAR_ERROR_NONE)
{
    // valid
}
else
{
    // error
}