|
kurosh Beginner
Joined: 01 May 2002 Posts: 18
|
Posted: Wed May 01, 2002 11:33 pm
Quick Q about timings |
I'm trying to get a trigger so that after something happens it waits say 2.2 seconds then says hi, but if the same thing happens again it resets and starts over at 2.2 seconds. I've tried using the #WAIT command but I dont know how to interrupt it. I've tried using the tick timer but that only has seconds not tenths of seconds. I've tried using the #loop command to count up to a number then do it but it's buggy and depending on how many programs I'm running it counts at different speeds. Any suggestions?
|
|
|
|
Tarn GURU
Joined: 10 Oct 2000 Posts: 873 Location: USA
|
Posted: Thu May 02, 2002 12:53 am |
A couple of points:
Using Wait inside a trigger is not recommended.
The next version of zMud will let you use tenths of a second in alarms.
Loops actually don't run 'straight through'; this prevents zMud from locking up on a long loop. This is probably why you see variable times.
Untested speculation that might hold you over until the next version: Perhaps if you use wait for the 0.2 seconds and then set a 2 second alarm, the wait wouldn't be quite so unpredictable/harmful. If this works, file it under 'dirty tricks that I won't report as bugs if they don't work the way I expect'
Just to give you a heads up on what's coming, www.zuggsoft.com/zmud/timers.htm
has a discussion of the various timers. Quite a bit of the explanation applies to 6.2x only. My point in telling you this is that maybe you'll gain better understanding of how things work, and/or decide that you can wait a bit for the next version, or that you're up for the beta. Usual beta disclaimers involving fire and brimstone apply.
-Tarn |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Thu May 02, 2002 1:16 am |
If you don't mind using 2-second (or 3) delay instead of 2.2 you could do something like this.
#TR {something happens} {#ADD something 1;#ALA +2 {#IF (@something = 1) {say hi};#ADD something -1}}
LightBulb
Vague questions get vague answers |
|
|
|
kurosh Beginner
Joined: 01 May 2002 Posts: 18
|
Posted: Thu May 02, 2002 2:28 am |
All good advice but you guys missed a major part that I need. I need to be able to stop the timer and restart it in mid-use.
|
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Thu May 02, 2002 2:51 am |
That's the purpose of the #IF statement. If the trigger fires a second time, then @something will be 2.
LightBulb
Vague questions get vague answers |
|
|
|
kurosh Beginner
Joined: 01 May 2002 Posts: 18
|
Posted: Thu May 02, 2002 3:31 am |
Works great, thanks lightbulb.
|
|
|
|
|
|