Documentation
IPS_SetEventCondition
Require: IP-Symcon >= 4.4
boolean IPS_SetEventCondition (int $EventID, int $ConditionID, int $ParentID, int $Operation)
Parameters
EventID | ID of the event to be changed |
||||||||||
ConditionID | Unique ID for this condition. The root condition needs to have the ID 0. The ID only needs to be unique for this event. |
||||||||||
ParentID | ID of the parent condition. On creation of the root condition, this parameter needs to be 0. |
||||||||||
Operation |
|
Returns
If the command succeeds, it returns TRUE, otherwise FALSE.
Description
This function modifies the condition with the ID ConditionID for the event with the ID EventID. The condition will become a child of the condition with the ID ParentID and use the operation Operation. If no condition with the ID ConditionID exists yet, it is created.
If ParentID is negative, the condition with the ID ConditionID is deleted. A condition cannot be deleted if it has child conditions. When a condition is deleted, all its rules are deleted as well.
A condition evaluates by applying its operation to the set of all its rules and child conditions. This can be used to create nested conditions.
Example
// Create root condition with the operation OR for event with ID 12345
IPS_SetEventCondition(12345, 0, 0, 1);
// Create a child condition with the operation AND
IPS_SetEventCondition(12345, 1, 0, 0);
// Delete child condition
IPS_SetEventCondition(12345, 1, -1, 0);