Okay, so I was playing around with waitfor, and noticed this.
PHP Code:
function onCreated()
{
temp.foo = timevar2;
scheduleevent(3, "DebugEvent", "");
if (waitfor(this, "DebugEvent", 5)) {
echo("test ==" SPC timevar2 - temp.foo);
} else echo("fail");
}
function onDebugEvent()
{
echo("onDebugEvent() triggered!");
}
As you can see, I'm scheduling an event in 3 seconds and right after doing a waitfor that lasts 5 seconds, waiting for the scheduled event to be done. This is the result on RC:
PHP Code:
The script of NPC DEBUG has been updated by xXziroXx
test == 3.069610118
As you can see, onDebugEvent() is triggered in 3 seconds... or is it? The waitfor seems to think so, but no matter what code I put inside the onDebugEvent() function, it's not executed. Is this a bug with waitfor/scheduleevent? If so, could it be fixed? If it's not, what am I doing wrong?
Note that this is just a test, I know of other perhaps more... accurate ways of using waitfor. Nonetheless, it'd be neat if this could work.