Go to documentation repository
The Sleep method pauses the execution of the script for a specified period of time.
Method call syntax
function Sleep(milliseconds : int)
Method arguments:
milliseconds – Required argument. The length of time that the script will be inactive for. Set in milliseconds. It takes the following values: Type – int.
Usage examples
Problem 1. When Macro 1 starts, play the following audio files one by one: cam_alarm_1.wav, cam_alarm_2.wav, cam_alarm_3.wav from the …\Axxon PSIM\Wav\ folder. Set a 5 seconds (5000 milliseconds) delay before starting each subsequent file.
if (Event.SourceType == "MACRO" && Event.SourceId == "1" && Event.Action == "RUN")
{
var i;
for(i=1; i<=3; i=i+1)
{
DoReactStr("PLAYER", "1", "PLAY_WAV", " file<\cam_alarm_" + i + ".wav>");
Sleep(5000);
}
}
Problem 2. When macro №2 starts, timer №1, that triggers every 10 seconds in a minute after macro №2 starting, starts.
Note
To start this script create the Timer object with ID=1 beforehand. Leave object parameters set by default (Any). The Timer 1 object can be disabled
if (Event.SourceType == "MACRO" && Event.SourceId == "2" && Event.Action == "RUN")
{
for(i=0; i<=5; i=i+1)
{
DoReactStr("TIMER","1", "DISABLE", "");
Sleep(10000);
DoReactStr("TIMER","1", "ENABLE", "");
NotifyEventStr("TIMER","1", "TRIGGER", "");
}
DoReactStr("TIMER","1", "DISABLE", "");
}