The fsVarsAVarSet function can be used to set the value of a specific AVar.

 

Syntax
FsVarError fsVarsAVarSet(
    FsAVarId aVarId,
    FsUnitId unitId,
    FsVarParamArray param,
    double value
    FsObjectId target
);

 

Parameters
ParametersDescription
aVarId

The ID of an AVar (found using fsVarsGetAVarId).

unitIdThe ID of a unit (found using fsVarsGetUnitId).
paramA parameter which might be mandatory to access the AVar (in the case of an indexed AVar, for example). Elements in param can be FsCrc, String or index.
valueThe new value of the AVar.
target

The ID of the object on which the variable is being set.

 

Return Values

This function returns FsVarError, where 0 means there is no error.

 

Example
FsUnitId unitId = fsVarsGetUnitId("DEGREES");
FsAVarId aVarId = fsVarsGetAVarId("ATTITUDE INDICATOR PITCH DEGREES");
FsVarParamArray param = FsCreateParamArray("i", 0);
double newValue = 123;
if (fsVarsAVarSet(simvarId, unitId, param, newValue, FS_OBJECT_ID_USER_AIRCRAFT) == FS_VAR_ERROR_NONE)
{
    // valid
}
else
{
    // error
}