|
Loftaris Adept
Joined: 24 Aug 2004 Posts: 277
|
Posted: Tue Jul 13, 2010 5:20 pm
Delay between triggers |
Is there a way to make it so a single alias doesn't fire more than once every x seconds?
What I currently do is name the trigger test, when the trigger fires it does what it needs to do, #T- test, #ALA +2 {#T+ test}
Isn't there a better way?
A box with a configurable # right in the trigger itself would be nice to have.
Prevent trigger from firing for desired amount of time in milliseconds. [ 1000 ]
.. just a thought. |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Tue Jul 13, 2010 8:25 pm |
There may be a better way, but that method is not bad. Can you give a little more detail about what this trigger does?
|
|
|
|
Loftaris Adept
Joined: 24 Aug 2004 Posts: 277
|
Posted: Tue Jul 13, 2010 8:26 pm |
It's not just this trigger, but any trigger I use. I have several that I'd love to delay. I end up with a whole bunch of alarms, and sometimes if I turn off all triggers the alarms don't work and the triggers never re-enable until I do it manually and remove the alarms.
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Tue Jul 13, 2010 9:42 pm |
Instead of using alarms, use a wait-state trigger:
#trigger "test" {blah} {blah blah}
#condition {} {stuff you want to do after the wait is over} {param=milliseconds to wait} |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Loftaris Adept
Joined: 24 Aug 2004 Posts: 277
|
Posted: Tue Jul 13, 2010 9:46 pm |
I don't want to do anything after the wait is over...
Or do you mean ..
#trigger "test"{blah} {blah;blah;#T- test}
#condition {} {#T+ test} {param=2000}
would that work? |
|
|
|
Moo Apprentice
Joined: 10 Apr 2009 Posts: 145
|
Posted: Tue Jul 13, 2010 9:51 pm |
How about using a variable to store the last value of %secs when the trigger fires. Next time the trigger fires, if the difference between the current %secs and what you have stored in your variable isn't long enough, just return, else, do whatever the trigger should do, and reset the variable to the current time.
This way you don't need alarms at all..
If you need the delays on many different triggers, you could even put the code for the checking in a separate function/alias that you call from the other triggers.. |
|
|
|
Loftaris Adept
Joined: 24 Aug 2004 Posts: 277
|
Posted: Tue Jul 13, 2010 9:54 pm |
Thanks. I'll play around with this a bit and see if I can get it to do what I want.
In the meantime, Zugg sir, could you add this feature to CMud ;) thanks.. hehe |
|
|
|
Moo Apprentice
Joined: 10 Apr 2009 Posts: 145
|
Posted: Tue Jul 13, 2010 10:03 pm |
D'oh. No.. Ignore my idea, just do like MattLofton said..
Been a while since I used multi-state triggers, but I have some doing the same thing already, so I should have remembered...
No, you don't need #t+/#t-... The trigger will go to the second state once the trigger fires, and then it'll go back to the first state..
But I think you need {Wait|param=2000} not just {param=2000} |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Wed Jul 14, 2010 2:44 pm |
Can you explain why you need to do this? I can't think of any use for it, but I don't doubt that there could be. But if we knew why you want to do it, there might be some other solution that doesn't even involve a delay.
|
|
|
|
|
|