Skip to content

Sleep ​

The procedure Sleep pauses program execution for the specified number of milliseconds.

A Cardinal data type simple means that it is an unsigned integer, because it does not carry a positive (+) or negative (-) assignment.

WARNING

Note that by specifying a negative value for milliseconds, this will cause your script to sleep indefinitely - like Snow White.

Declaration: Procedure Sleep(Milliseconds: cardinal);

A simple example would be as follows.

pascal
procedure OnMapEvent(var Value:Variant);
var stopper : cardinal;
begin
  LogInfo('This is the start of the script.');
  LogInfo('Just going to take 40 winks . . . ');
 //Pauses program execution for 5,000 milliseconds (i.e. 5 seconds)
  Sleep(5000);
  LogInfo('Just time enough to grab a coffee.');

  stopper := 8000;
 //Pauses program execution for 8,000 milliseconds (i.e. 8 seconds)
  Sleep(stopper);
  LogInfo(' . . . if you were quick!');
  LogInfo('');
end;