|
Belmyrddyn Magician
Joined: 17 Oct 2001 Posts: 371 Location: USA
|
Posted: Sun Feb 10, 2002 1:47 am
Pausing |
Okay, I know I shouldn't use the #WAIT command to pause for a few seconds, but I was wondering how I could improve on the method that I do it.
I do something like this;
#Alarm +@VAR1 {#VAR Continue1 1}
#UNTIL (@Continue1 = 1) {#VAR TempVar 3
#MATH TempVar @TempVar*6
#MATH TempVar @TempVar/2
#MAth TempVar @TempVar+6
}
Or some such. I was wondering how everyone else is implementing pausing in their scripts, or if they can see some improvements on loop here.
Belmyrddyn |
|
|
|
Darker GURU
Joined: 24 Sep 2000 Posts: 1237 Location: USA
|
Posted: Sun Feb 10, 2002 2:04 am |
Without more information on how what this is supposed to do, I can't offer specific advice. However, there are new ways of looping coming out in the next public version (they're available now in beta). Check out http://www.zuggsoft.com/library/trigadv.htm
zMUD 6 Online Help: All the power you'll ever need. |
|
|
|
Belmyrddyn Magician
Joined: 17 Oct 2001 Posts: 371 Location: USA
|
Posted: Sun Feb 10, 2002 2:11 am |
The point is to delay the current script for a certain number of seconds.
Belmyrddyn |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Sun Feb 10, 2002 3:07 am |
All manner of intra-script delays will stop mud output processing. That was the problem with WAIT, a long WHILE loop was causing some odd problems in a recent beta. The only good way to do such a delay currently is with two aliases and an alarm
#AL badway {
command1
command2
#WAIT 5000
command3
command4}
#AL goodway1 {
command1
command2
#ALARM {+5} {goodway2}}
#AL goodway2 {
command3
command4}
The bad thing about that setup is it becomes a pain to debug. The better way is to make your triggers tighter to the data you want to procces. Think of Zmud as a person in a restaurant, first trigger host asking about where to be seated, everything else is ignored. That fires response {one;smoking;follow host}. Trigger at table fires response {sit;open menu;#T+ MenuReader}. Tight to the data, not like {enter restaurant;#WAIT 5000;one;smoking;follow host;#WAIT 3000;sit;open menu;#T+ MenuReader}. What happens when it takes 6 seconds to walk to your table, you sit on the floor? Anyhow you get the idea, delays are bad, selective processing is good. |
|
|
|
Belmyrddyn Magician
Joined: 17 Oct 2001 Posts: 371 Location: USA
|
Posted: Sun Feb 10, 2002 3:54 am |
I know, but in my mud there are certain things that require delays, called roundtimes. The game won't process a new command until the last one finishes.
So the command 'jab goblin' generates a roundtime which depends on your strength, stamina, weight of weapon, random factor, etc.
It tells you this via;
[Roundtime: 6 secs.]
So, in a script, I want to be able to read this, and without using a #wait command, pause 6 seconds before continuing on with the script. I'm not sure how I should be implementing this, however.
Belmyrddyn |
|
|
|
dacheeba Adept
Joined: 29 Oct 2001 Posts: 250
|
Posted: Sun Feb 10, 2002 4:45 am |
So, does it ever get to a point where it says:
[Roundtime: 0 secs.]?
Because if thats the case you could make a trigger like this:
#TR {~[Roundtime: &Rtime secs.~]} {}
and then whatever you want to make it wait for just use an #IF:
#IF {@Rtime=0} {whatever you want to fire}
that may help |
|
|
|
Belmyrddyn Magician
Joined: 17 Oct 2001 Posts: 371 Location: USA
|
Posted: Sun Feb 10, 2002 5:00 am |
Unfortunately not... It'll just tell you how long the RT is.
[Roundtime 6 secs.]
And if you try to enter an command that requires RT it'll say...
You have a roundtime of 5 seconds.
But it count down for you. I've got the tick timer set so it picks up the Roundtime, though, so I know how long the current RT is.
Belmyrddyn |
|
|
|
Belmyrddyn Magician
Joined: 17 Oct 2001 Posts: 371 Location: USA
|
Posted: Sun Feb 10, 2002 5:00 am |
Sorry... It doesn't count down for you. ;)
Belmyrddyn |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sun Feb 10, 2002 7:19 pm |
You can set a one-time alarm based on the roundtime message. The alarm can be used to fire other triggers by use of the #SHOW command, or it could be used to set/reset a control variable to indicate whether or not roundtime is in effect. How to use that information is up to you.
#TR {Roundtime: (%d) secs} {#VAR Roundtime 1;#AL +%1 {#VAR Roundtime 0;#SHOW Roundtime expired}}
LightBulb
All scripts untested unless otherwise noted |
|
|
|
itsmarty Novice
Joined: 29 Jan 2002 Posts: 37 Location: USA
|
Posted: Fri Feb 22, 2002 6:19 am |
Belmyrddyn, how did you get the tick timer to pick up the roundtime?
Thanks,
Martin |
|
|
|
|
|