Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ A wait command
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Rhinoa
United Kingdom (37 posts) Bio
|
Date
| Tue 03 Sep 2002 02:20 AM (UTC) |
Message
| Is there any way on making the world wait without using timers in VBS?
Like..
world.note "5 seconds will pass"
wait 5
world.note "Told ya :p"
Thanks in advance =)
~Rhinoa~ | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #1 on Tue 03 Sep 2002 02:45 AM (UTC) |
Message
| This question keeps coming up. It must be popular! :)
You can't pause a script in that way, because the whole client would pause. You can do your example like this:
world.note "5 seconds will pass"
world.doafter 5, "Told ya :p"
For more complex examples, you need to make a timer (eg. a one-shot, temporary timer) that will fire in 5 seconds. That timer calls a script routine that does whatever it is you want to do in 5 seconds. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Lhzooro
(8 posts) Bio
|
Date
| Reply #2 on Tue 15 Jun 2004 08:43 AM (UTC) Amended on Tue 15 Jun 2004 08:51 AM (UTC) by Lhzooro
|
Message
| but when the action to do is a path....
world.doafter 5, "Told ya :p"
^^^^^^^^^^
world.doafter 5, "#4w"
it just been send to the outwindow,but i mean go west 4 times.
and a question:
world.doafter 1, "A"
"B"
action "B" will be execute before "A",that's not my mean.
my mean is scripts wait 1 second ,and then do "A" and "world.doafter 1, "B"
| Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #3 on Tue 15 Jun 2004 10:27 AM (UTC) |
Message
| For the first one youll need to make it a doafterspeedwalk:
world.DoAfterSpeedwalk 5, "4w"
should work.
|
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
Posted by
| Lhzooro
(8 posts) Bio
|
Date
| Reply #4 on Tue 15 Jun 2004 10:59 AM (UTC) |
Message
| thank you..i have solve it ..
I think it's troubled when i have to wait 3 times on my path. Should I need to use DoAfter in a Doafter and in a DoAfter?
What I realy need is a function that cant pause a script for x second just like "#wait 1000" in the Zmud.
Is there have one in MUSHclient? | Top |
|
Posted by
| Shadowfyr
USA (1,791 posts) Bio
|
Date
| Reply #5 on Tue 15 Jun 2004 05:14 PM (UTC) |
Message
| No there isn't. You would have to suspend the script, have Mushclient wait a set amount of time, then continue in the same place. I have no idea of this is even possible, especially since while waiting the script could be called all over again. zMud gets by with it because 'it' does the scripting. There is something that can pause a script, but it has the side effect of freezing the client completely for that period of time, so nothing, including new text arriving, happens while paused. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #6 on Tue 15 Jun 2004 11:39 PM (UTC) |
Message
|
Quote:
Should I need to use DoAfter in a Doafter and in a DoAfter?
You can, but this is simpler:
DoAfter 5, "say hello"
DoAfter 6, "eat food"
DoAfter 7, "drink water"
This make you "say hello" after 5 seconds, then after one more second (6 in total) eat food, and then after another second drink water. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Lhzooro
(8 posts) Bio
|
Date
| Reply #7 on Wed 16 Jun 2004 12:34 AM (UTC) |
Message
| Thanks a lot ..
I think the difrent between Zmud and Mush is that:
Zmud is running a Script and Mush is running a program which is translate from Script just like PERL.
Last Night I thinked an other idea about this:
Could I make a sub FUNCTION just wasting time?
like:
sub wait ()
for (i=0;i<1000000;$i++) {do nothing just cost time}
end sub
When I need to wait . I call this sub.
Could I?
:)
| Top |
|
Posted by
| David Haley
USA (3,881 posts) Bio
|
Date
| Reply #8 on Wed 16 Jun 2004 12:36 AM (UTC) |
Message
| How would that accomplish anything different then just pausing and doing nothing? |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #9 on Wed 16 Jun 2004 12:43 AM (UTC) |
Message
| When you did that, your WHOLE client would freeze. You wouldnt be able to do anything, you wouldnt recieve any text from the mud, or anything of the sort.
But yes, Mushclients scripting does allow you to simply call routines. Except that one wouldnt be very useful. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
Posted by
| Lhzooro
(8 posts) Bio
|
Date
| Reply #10 on Wed 16 Jun 2004 12:47 AM (UTC) |
Message
| PAUSE :
Description Turns on or off the "paused" flag for all output windows in this world.
PAUSE will stop the output windows.
These is a diffrent I think
| Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #11 on Wed 16 Jun 2004 03:32 AM (UTC) |
Message
| That merely stops the world from getting any new output. The client still recieves and sends and whatever, but the output window doesnt change position or have any new output. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #12 on Wed 16 Jun 2004 06:22 AM (UTC) |
Message
|
Quote:
sub wait ()
for (i=0;i<1000000;$i++) {do nothing just cost time}
end sub
This whole topic must have been covered, like, 100 times, but briefly, what that would do is take your CPU usage up to close to 100% for a while. Not only would it freeze the client, it would also go close to freezing everything else (eg. your mail program, your web browser).
It is a rather brute-force way of making a delay, and may not even work as intended.
For instance, if you did this:
Send "say hi there"
call wait
Send "say I'm back after 5 seconds"
That probably wouldn't even work. Why? Because your CPU loop that the "wait" sub is in would also stop the operating system from doing TCP/IP, thus your original "say hi there" would probably be in the bowels of the operating system "hanging" until it got the CPU back from your script.
Then the two messages would still be sent in quick succession (when the 5 seconds, or whatever, were up). |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Leera2008
(9 posts) Bio
|
Date
| Reply #13 on Fri 18 Jun 2004 02:41 AM (UTC) |
Message
| Thanks for all.
:)
I now use lots of "DoAfter" in my programs.
| Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #14 on Fri 24 Dec 2004 03:59 AM (UTC) |
Message
| |
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
46,413 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top