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.
Entire forum
➜ MUSHclient
➜ General
➜ timer help
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Guest1
USA (256 posts) |
Date
| Wed 21 Aug 2002 07:05 AM (UTC) |
Message
| This is probably simpler than I think, but this is what I'm wanting to do:
Whenever I cast a particular spell, I want a message to come up (a grouptell message) 5 minutes later warning the spell is about to drop.
The way I -think- I should do this is to have the existing alias I have that casts the spell to also call a subroutine. The subroutine will enable the timer which is set to fire every 5 mins. Once it's enabled, theoretically it should then fire in 5 minutes time and give the warning message. I would also have it call another script when it fires which disables the timer itself. So far so good.
Does this sound right, or is there an easier way around this?
Also, with another existing timer I have that fires every 1 minute with a message, when I first activate (enable) it, it sends the message then too, which I don't want to happen with this new timer I am planning on setting up. So, is there an easier way to do what I want?
I am wondering if there is some type of vbs routine I can do that when I cast the spell, the subroutine basically says 'wait 5 minutes, then send this message' ..but I don't know if that is possible, and if so, I don't know the correct syntax. Can anyone help? | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #1 on Wed 21 Aug 2002 07:55 AM (UTC) |
Message
| This is very simple. A fairly recent script routine will do that for you. Just get the alias to call a script, eg. NotifyUs, which looks like this:
sub NotifyUs (sName, sLine, wildcards)
world.doafter 5 * 60, "gtell Spell XXX is about to expire"
end sub
DoAfter takes seconds as its first argument, so 5 * 60 would be 5 minutes (or you could just use 300).
No timer should fire when first enabled, this certainly shouldn't. The DoAfter timer is a "on-shot" timer so you don't need to disable it - it will only do its stuff once.
Your problem with enabling timers might be that they are already expired, so once enabled they fire.
Try using ResetTimer first (which resets it back to 0 seconds elapsed) and then enable it. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Guest1
USA (256 posts) |
Date
| Reply #2 on Wed 21 Aug 2002 07:56 AM (UTC) |
Message
| ..ok, more info which I can't locate in help; when I use
world.ResetTimers
in a subroutine, am I able to specify which timer(s) to reset, or does it have to reset all of them? | Top |
|
Posted by
| Guest1
USA (256 posts) |
Date
| Reply #3 on Wed 21 Aug 2002 07:57 AM (UTC) |
Message
| Excellent :) Thanks for that script Nick, exactly what I needed. | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #4 on Wed 21 Aug 2002 08:11 AM (UTC) |
Message
| Yes you can do one, check out ResetTimer (not resettimers). |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Guest1
USA (256 posts) |
Date
| Reply #5 on Wed 21 Aug 2002 08:22 AM (UTC) |
Message
| That's great, thanks for your help Nick, you just solved a number of problems for me :) | 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.
16,464 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top