Go to documentation repository
The Sleep method pauses the execution of the script for a specified period of time.
Method call syntaxSyntax for method invocation:
| Code Block | ||
|---|---|---|
| ||
function Sleep(milliseconds : int) |
Method arguments:
...
...
Example 1. On macro 1, playback
Usage examples
Problem 1. When Macro 1 starts, play the following audio files one by one with audio player 1: cam_alarm_1.wav, cam_alarm_2.wav, cam_alarm_3.wav from the …\Axxon PSIM\Wav\ folder. Set a 5 The delay between the playback of each audio file must be five seconds (5000 milliseconds) delay before starting each subsequent file.
| Code Block | ||
|---|---|---|
| ||
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 Example 2. When On macro №2 starts2, start the timer №1, 1 that triggers every 10 seconds in for a minute after macro №2 starting, startsfrom the start of macro 2.
| Info | ||
|---|---|---|
| ||
To start this script, you must create the Timer object with ID = 1 beforehand. Leave the default object parameters set by default (Any). The Timer 1 object can be disabled. |
| Code Block | ||
|---|---|---|
| ||
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", "");
} |
...