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
➜ How to kill a wait routine?
How to kill a wait routine?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Whininguser
Canada (30 posts) Bio
|
Date
| Sat 05 Jan 2013 02:45 AM (UTC) Amended on Sat 05 Jan 2013 02:56 AM (UTC) by Whininguser
|
Message
| This is the wait routine I'm using:
http://www.gammon.com.au/forum/?id=4956&reply=1#reply1
Suppose I have a function like this:
function my_alias_thread ()
Send ("eat bread")
wait (30)
-- Is there anything I can write here (or elsewhere) to
-- terminate the 30-second wait above? Thanks.
Send ("eat bread")
wait (1)
end | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sat 05 Jan 2013 05:11 AM (UTC) |
Message
| It could be done, but I'm not at my usual PC right now. The wait (time) is done by a timer which eventually calls coroutine.resume (thread).
If you could work out the thread then you could make something else resume the (main) thing which is waiting.
That is how the wait.match works. You either get a trigger match or a timeout. So if you want to cancel for some other reason you expand that concept. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Whininguser
Canada (30 posts) Bio
|
Date
| Reply #2 on Sat 05 Jan 2013 10:31 PM (UTC) |
Message
| Suppose the 30-second wait is named "wait_123". The only solution I know is this:
SetTimerOption ("wait_123", "second", "0")
Is there a better way to do it? (Newbie to coroutine)
| Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Sun 06 Jan 2013 01:29 AM (UTC) |
Message
| You need to look at what the timer does when it expires and do that "right now". It's just code. You don't have to do it when the timer expires. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Whininguser
Canada (30 posts) Bio
|
Date
| Reply #4 on Sun 06 Jan 2013 01:48 AM (UTC) |
Message
| Got it (I think). Thanks Nick. | Top |
|
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.
14,709 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top