Create new timers from script?

Posted by Scorch on Sat 27 Dec 2003 10:18 PM — 2 posts, 11,561 views.

#0
I wanted to make temp timers from a script which is activated by a trigger (for protection spells on a MUD, spell goes up, 5 minutes later it goes back down). The problem with using a predefined timer is I want to be able to cast these protection spells on more than one person, perhaps an entire party of 8. It'd be much more efficient to be able to create a temporary timer that calls a function that tells everyone the spell is failing for a particular person.

I can't seem to find anything in the help files on creating new timers via the scripting language though, any help?
Australia Forum Administrator #1
First, look at these online help pages:

http://www.gammon.com.au/scripts/doc.php?general=timers

(Follow the hyperlinks to the various timer-creating functions).

However the quick answer is you could use the "DoAfter" function to cast spells after a certain interval. For example:

DoAfter 300, "cast protection Nick"

You could do that in a trigger by putting that in the trigger "send" text and changing it to "send to script".

To do a whole party you could add more lines to the trigger, or if the party varies a lot, keep a party list in a variable, extract that variable using Split, and then use "for each" to iterate through the extracted array. If you want an example of doing that let us know.