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
➜ VBscript
➜ Trigger to create a timer
Trigger to create a timer
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| ErockMahan
(81 posts) Bio
|
Date
| Tue 09 Dec 2008 06:56 PM (UTC) |
Message
| I think what I'm trying to do is simple: I want a trigger to create a timer. It can't be a "do after special" deal, because if it fails, I want to try again.
Something like this (in alias form):
I type: fart Bob
It creates a timer called FartBob if possible. I want it to have a unique name so it can be deleted later...
After 5 seconds it sends to world "fart Bob"
If successful ("you fart on bob!"), I can have a trigger "deletetimer fartbob" delete it.
Otherwise ("You don't see bob here..."), it will try again in another 5 seconds.
I've tried the world.addtimer function, but that seems like it will fire at a certain time of day, not at a certain interval.
I suppose it would be easier to make a "only fire once" timer that would re-create itself on the failed message somehow, but I haven't seen anything like that in the help files either.
It isn't THAT important that I fart on dear Bob, so if this is going to be overly complicated, just let me know and I'll drop it. I'm sure people have better things to do with their time. (And in case you're wondering, the practical application of this is to be able to cast spells on a target when they are in another room so they'll be cast when I see them again. I don't go around farting!) | Top |
|
Posted by
| Worstje
Netherlands (899 posts) Bio
|
Date
| Reply #1 on Wed 10 Dec 2008 02:17 AM (UTC) |
Message
| There's a number of ways to get what you want. Your primary issue is that you cannot seem to figure out how to set the timer to be an interval rather than a specific time of day. You could use ImportXML() to load a pre-written trigger, or alternatively you could use SetTimerOption() with your current AddTimer call. The option you'd try to set with SetTimerOption can be found by copying a timer with the interval option set and looking at it in notepad.
If you want, I can work out an example or stuff, but I think this should help you along for now.
| Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #2 on Wed 10 Dec 2008 06:01 AM (UTC) |
Message
| AddTimer lets you set intervals. See:
http://www.gammon.com.au/scripts/doc.php?function=AddTimer
Check out the flags.
In any case, you could just do it with a trigger on "you don't see Bob here" which tests a flag, and if that flag is set, redoes the timer. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| ErockMahan
(81 posts) Bio
|
Date
| Reply #3 on Wed 10 Dec 2008 04:30 PM (UTC) Amended on Wed 10 Dec 2008 04:31 PM (UTC) by ErockMahan
|
Message
| Thank you, once again! It never ceases to amaze me how many answers you're still able to provide!
In case anyone finds this thread, the script to use is this:
world.addtimer "name", 0, 0, 10, "what you're doing", 5, "" | 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,785 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top