RegisterVariable Function

Registers a new numeric variable.

Syntax

bool RegisterVariable(
const string&in name,
double defaultVal
)

Parameters

const string&in name
The variable name.

double defaultVal
The default value of the variable.

Return value

bool
true if the variable was registered successfully, false if it already exists.

Remarks

The variable will be created with the default value and can be accessed by other plugins. When the function is called, TMInterface will try to see if the variable had been registered before and has an existing value. If it does, TMInterface will immediately restore the value, making the variable act as a setting.

It is not possible to deregister a variable in the same game instance. You have to restart the game to either remove the variable or change its type.