Register forum user name Search FAQ

Gammon Forum

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 ➜ Tips and tricks ➜ Triggers and timers

Triggers and timers

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by ErockMahan   (81 posts)  Bio
Date Thu 22 Jul 2004 06:20 PM (UTC)
Message
Is there any way to set a trigger that will start a timer when it fires?

And while I'm asking you learned smarties to show off, is there any way to check that progressively? Or have it send a little message "Timing thingy is half over!" or whatever?
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 22 Jul 2004 10:24 PM (UTC)
Message
Depends what you want the timer to do. There are quite a few ways of doing it.

Set the trigger to "send to script" and in the script you could do this:

DoAfterNote 10, "Time's up!"

This will make a note (a message only you see) after 10 seconds.

You can also use DoAfter (to send to the MUD) or DoAfterSpecial (to send to anywhere, eg. scripting).

For more complex requirements you can use AddTimer.

As for checking it progressively, well you probably need a second timer for that. :)

A simple half-way message could be done like this:

DoAfterNote 5, "Half-way"
DoAfterNote 10, "Time's up!"

That is, one message after 5 seconds, another after 10 seconds.

For more detail you could have a second timer that fires (say, every 5 seconds). This would need to keep firing (ie. use AddTimer and make it an "every x second" timer).

The second timer can use GetTimerInfo, selector 13, to get the number of seconds that the first timer has to go, and then display that.

Then when the second timer finds the first has fired, or disappeared, or whatever, it can delete itself.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


10,329 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.