Page 1 of 1
Delay and timers?
Posted: Tue Sep 17, 2002 5:07 pm
by DeathSpiral
Howdy-
I've been playing around now with timers, and it appears that delays can royally goof timers up - ie, the timer doesn't decriment while delaying. Can anyone confirm / deny this? Would love to know if its something I'm doing or more of a MQ issue.
Posted: Wed Sep 18, 2002 10:47 am
by Red Moogle
Hmm i think that /delay dose stop timers I have noticed that if i do /mqpause it will stop the timers if im wrong *shurg* a way to dest this would be...
Code: Select all
Sub Main
/varset t0 300
/echo $t0
/delay 100
/echo $t0
/return
tell me what ya find out id be interested
Posted: Wed Sep 18, 2002 11:13 pm
by DeathSpiral
For the hell of it, I injected two test timers into one of my scripts that uses delays and did some testing. The script in question loops alot, and has a single /delay 2 in it. The timer did -not- count down while delaying, or at least that seems to be the case. I set a 150 second timer, and I looped exactly 80 times before the timer fired. When it fired, it fired after 166 seconds of execution (16 seconds late, or, .2s delay per loop, coinciding exactly with the amount of delay). Further testing by resetting the timer to 150 seconds and checking execution time has born out exactly the same: (ie, not some first timer cycle glitch; I let the timer cycle 10 times, and every time it was 16seconds late). Which leads me to ask: is this a bug or a feature?
Posted: Thu Sep 19, 2002 9:09 am
by eq_freak
Aha! Thanks for figuring that out deathspiral, definately sound like a bug(but now that we know about it, at least we can code round it). Perhaps the /delay command could be made to subtract the appropriate amount from all timers?
Personally I have been having some problems in my script that kills static mobs, specifically I have been using a timer so I know when static mobs in my pullpath are about to spawn. However setting the timer the same as the realworld repop time, never seemed to work. I always assumed the MQ timer was simply inaccurate, but since I use alot of delays, this explains the observed behavior fully :)
Posted: Thu Sep 19, 2002 10:47 am
by DeathSpiral
Before I started playing with timers (and, well, still, to be honest...) instead of using timers, anytime an event of significance happened, I'd record the current value from $running in a global variable, and then check against that difference. That is always accurate, /delay or no /delay. However, it means instead of having a nice Event_Timer firing that we can then call another (or many) funcs from, we have to put a whole ton of /if's in our code, and take up (potentially) valueable global vars with $running amounts. /shrug Not sure if there is a 'right answer' right now.
Posted: Thu Sep 19, 2002 4:40 pm
by pxlpluker
why not use real time.
$time(xxx)
Returns the time.
xxx can be: h, m, s
Posted: Tue Sep 24, 2002 9:28 pm
by AMadMonk
Hmm, note to self: add separate dedicated timers thread.