[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  timer help

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

timer help

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Demonsurfer   USA  (256 posts)  [Biography] bio
Date Wed 21 Aug 2002 07:05 AM (UTC)  quote  ]
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?
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Wed 21 Aug 2002 07:55 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Demonsurfer   USA  (256 posts)  [Biography] bio
Date Reply #2 on Wed 21 Aug 2002 07:56 AM (UTC)  quote  ]
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?
[Go to top] top

Posted by Demonsurfer   USA  (256 posts)  [Biography] bio
Date Reply #3 on Wed 21 Aug 2002 07:57 AM (UTC)  quote  ]
Message
Excellent :) Thanks for that script Nick, exactly what I needed.
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Wed 21 Aug 2002 08:11 AM (UTC)  quote  ]
Message
Yes you can do one, check out ResetTimer (not resettimers).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Demonsurfer   USA  (256 posts)  [Biography] bio
Date Reply #5 on Wed 21 Aug 2002 08:22 AM (UTC)  quote  ]
Message
That's great, thanks for your help Nick, you just solved a number of problems for me :)
[Go to top] 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.


1,952 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]