Sleep


Pauses the message for the given delay. The next line of code will not run until the delay has ended. Syntax:

Sleep(flex_delay);

A message runs like a set of instructions. These instructions are normally performed instantly, but Sleep() can be used to pause the execution of the instructions. The message can still be called even while a sleep is used. JK will simply process the same instructions. It is important not to think of a message as a single entity. The following code demonstrates the point:

activated:
     if(on) Return;
     on=1;
     PlaySoundLocal(wav, 1, 0, 0);
     Sleep(GetSoundLen(wav));
     on=0;

Return;