Thread: waitfor bug?
View Single Post
  #1  
Old 08-16-2008, 10:23 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
waitfor bug?

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.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote