« Back to Product

Documentation

IPS_SetScriptTimer

 boolean IPS_SetScriptTimer (int $ScriptID, int $TimerValue) 

Parameters

ScriptID

ID of the script

TimerValue

Time in seconds in which the script is called cylically

Returns

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

Description

This function sets the start value of the script timer of the script with the ID __Script_ID to TimerValue__. The value defines the time in seconds. The timer from the script counts down from the start value in steps of seconds. When the timer reaches 0 the script is executed and the script timer is reset to the start value. This process is repeated until the timer is explicitely deactivated. A timer is deactivated by setting the start value to 0.

Warning

The duration of the timer can only be set on an exact second value if the timer value is 3600 or less. For values above 3600, irregularities can occur, depending on start time and/or divisor as the script timer shares the same limitations as normal cyclic events and their time templates. E.g., if a timer is set to 5 hours at 6:00, it triggers at 6:00, 11:00, 16:00, 21:00, and 1:00, even though 2:00 could have been expected. Values above the day border are rounded up to whole days.

Example

// The script is run every 10 seconds
IPS_SetScriptTimer($ScriptID, 10);
Any questions?