Delay and timers?

A forum for the general posts relating to MacroQuest. *DEPRECATED: This forum is no longer in public use, but remains here for your reading pleasure. Enjoy

Moderator: MacroQuest Developers

User avatar
DeathSpiral
a ghoul
a ghoul
Posts: 95
Joined: Thu Aug 22, 2002 6:31 pm

Delay and timers?

Post by DeathSpiral » Tue Sep 17, 2002 5:07 pm

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.
I am orc pawn, hear me yell for centurians...

Red Moogle
orc pawn
orc pawn
Posts: 23
Joined: Sat Sep 14, 2002 10:27 pm

Post by Red Moogle » Wed Sep 18, 2002 10:47 am

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
:Loop
/echo Kupo!
/goto :Loop

User avatar
DeathSpiral
a ghoul
a ghoul
Posts: 95
Joined: Thu Aug 22, 2002 6:31 pm

Post by DeathSpiral » Wed Sep 18, 2002 11:13 pm

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?
I am orc pawn, hear me yell for centurians...

eq_freak
a ghoul
a ghoul
Posts: 105
Joined: Mon Jun 24, 2002 7:17 am

Post by eq_freak » Thu Sep 19, 2002 9:09 am

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 :)

User avatar
DeathSpiral
a ghoul
a ghoul
Posts: 95
Joined: Thu Aug 22, 2002 6:31 pm

Post by DeathSpiral » Thu Sep 19, 2002 10:47 am

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.
I am orc pawn, hear me yell for centurians...

pxlpluker
a lesser mummy
a lesser mummy
Posts: 53
Joined: Tue Aug 27, 2002 12:20 pm

Post by pxlpluker » Thu Sep 19, 2002 4:40 pm

why not use real time.
$time(xxx)
Returns the time.
xxx can be: h, m, s

AMadMonk
a lesser mummy
a lesser mummy
Posts: 77
Joined: Tue Sep 24, 2002 9:16 pm

Post by AMadMonk » Tue Sep 24, 2002 9:28 pm

Hmm, note to self: add separate dedicated timers thread.