« Back to Product

Documentation

IPS_SetVariableCustomAction

 bool IPS_SetVariableCustomAction (int $VariableID, int $ScriptID) 

Parameters

VariableID

ID of the variable

ScriptID

ID of the script that should be used as variable action. The nonexistent ScriptID 1 (VARIABLE_ACTION_DISABLED) can be given to disable the default action. If a valid ScriptID is specified, it is used instead of the default action. To enable the default action (if available), ScriptID 0 (VARIABLE_ACTION_NONE) must be specified.

Returns

If the function succeeds, it returns TRUE, otherwise FALSE.

Description

This function assigns a custom action to the variable with the ID VariableID. The custom action is used in the visualization to forward a change in the variable to the proper function of the module. Examples of action scripts can be found here: Action Scripts

Besides a ScriptID, the following values can be specified:

Value Constant Description
0 VARIABLE_ACTION_NONE No custom action. The default action is used, if available.
1 VARIABLE_ACTION_DISABLED The default action is disabled.

Example

// Set script 44431 as action of variable 12345
IPS_SetVariableCustomAction(12345, 44431);

// Disable the default action of variable 12345
IPS_SetVariableCustomAction(12345, VARIABLE_ACTION_DISABLED);

// Enable the default action of variable 12345 again
IPS_SetVariableCustomAction(12345, VARIABLE_ACTION_NONE);
Any questions?