Sleep(flex_delay);
Note that you may not have more than four simultaneous sleeps in a cog. Some example code with Sleep():
activated: if(on) Return; on=1; PlaySoundLocal(wav, 1, 0, 0); Sleep(GetSoundLen(wav)); on=0; Return;