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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  VBscript
. . -> [Subject]  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] Refresh page


Posted by ErockMahan   (81 posts)  [Biography] 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!)
[Go to top] top

Posted by Worstje   Netherlands  (899 posts)  [Biography] 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.

[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] 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
[Go to top] top

Posted by ErockMahan   (81 posts)  [Biography] 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, ""
[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.


15,037 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

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

[Best viewed with any browser - 2K]    [Hosted at HostDash]