PDA

View Full Version : Waitfor?


projectigi
12-30-2007, 01:19 AM
Hi,

uh i tried using waitfor, ex:

function onCreated()
{
echo( "waiting" );

if( waitfor( this, "onChange", 5 ) == false ) echo( "timeout" );
else echo( "event" );
}

function onChange( test )
{
sendtorc( "waiting again" @ test );

if( waitfor( this, "onChange", 5 ) == false) echo( "timeout" );
}

now when onChange is called in the 5 secs before the timeout runs out it echoes "event" but but doesnt say "waiting again", how can i make it so it runs the functions too(with the params sent to it)

Inverness
12-30-2007, 01:47 AM
Make it trigger the event after it echos "event"

cbk1994
12-30-2007, 02:07 AM
Do you want something like

scheduleevent( 5, "Change", null );

?

projectigi
12-30-2007, 12:07 PM
Make it trigger the event after it echos "event"

well, but that discards the "test" param passed to the original trigger, doesnt it?

Do you want something like

scheduleevent( 5, "Change", null );

?


nope

Inverness
12-30-2007, 01:58 PM
well, but that discards the "test" param passed to the original trigger, doesnt it?Yes, I had an issue with that myself. I simply resorted to using a this. variable.