fsVarsAVarSet

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
Parameters Description
aVarId

The ID of an AVar (found using fsVarsGetAVarId).

unitId The ID of a unit (found using fsVarsGetUnitId).
param A 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.
value The new value of the AVar.
target

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

Possible targets are:

  1. FS_OBJECT_ID_USER_AIRCRAFT
  2. FS_OBJECT_ID_USER_AVATAR
  3. FS_OBJECT_ID_USER_CURRENT

Default: FS_OBJECT_ID_USER_AIRCRAFT.

 

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
}