Thread: if (timeout)
View Single Post
  #5  
Old 04-24-2009, 04:04 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally Posted by Schetti View Post
I know, the script itself is useless, but it MUST have a timeout, doesnt it? So, it sends the "works?" like a spam, but NO "timeout?"

someone can explain why?
onTestTime gets first executed without a timeout set, so there is no chance that "if (timeout)" is true at that point. So the settimer inside the if-block is not being executed either. Consequently the recursive call to onTestTime also happens without a timeout being active, and we basically start from the beginning over and over again until you run out of stack space and the recursion terminates. At that point, the script might either error out or go to the next statement, not sure. If the latter is the case, you will finally set your timer and onTimeout() will be called 0.05 seconds later, setting the timer again and continuing the timeout loop. Since onTimeout is not calling onTestTime, your "if (timeout)" check is not going to be executed anymore and the sendtorc still does not happen.

Your expectation that something different happens implies that you think there is some magic going on that is not actually there.

Last edited by Loriel; 04-24-2009 at 04:16 PM..
Reply With Quote