I suspect you are using a timeout loop. Sleep will stop a timeout loop if a fuction is triggered from an outside function of the loop. Might be able to save some lines if simply add an adding number and either a if-else block, for loop, or a switch statement.
PHP Code:
function onCreated()
{
this.chatText = { "Blah0", "Blah1", "Blah2"}; // For second method
}
function onTimeout()
{
this.i ++;
//Then either
if ( this.i == 0) Blah0;
else if ( this.i == 0) Blah1;
else Blah2;
// or
for ( temp.i = 0; temp.i < 3; temp.i ++;)
{
this.chat = this.chatText[ temp.i];
sleep( 0.15); // assuming your time out is 0.05
}
// or finaly
switch ( this.i)
{
case 0: Blah0; break;
case 1: Blah1; break;
case 2: Blah2; break;
}
setTimer( 0.05);
}
Just remember for these method you will have to add the extra sleep( 0.15); within those to extend the waiting for the time out. Which using the sleep in the timeout might be detrimental in what you are trying to do. Using scheduleEvent, catchEvent, or waitfor as Emera demonstrated would be best without breaking or delaying the timeout.