Page 1 of 1

How do I top a trigger for going off multiple times in a row?

Posted: Sun Feb 11, 2018 5:33 pm
by raksasas
Sorry, a new mudlet guy here. How can I make a triger only go off once? I can't didn't notice anyting on this in the mudlet documents. I found on a post similar but I don't under stand it and it doesn't seem to let me put a link to the forum post.

Anyway, In a mob fight I can get the following pattern. (I currently have this trigger disabled.)
pattern:
You fail to concentrate enough.

The action:
drink potion

This works but sometimes I don't catch it and it the pattern comes up a few times. I end up wasting potions.

You fail to concentrate enough.
You fail to concentrate enough.
You fail to concentrate enough.

drink potion
drink potion
drink potion

How can I prevent this from happening? I am thinking maybe it can wait 1 minute after the first pattern before it will trigger on the pattern again? I am not a coder and from what I can tell mudlet is very script friendly and that is a little above my head.

Thanks

Re: How do I top a trigger for going off multiple times in a row?

Posted: Sun Feb 11, 2018 8:46 pm
by Jor'Mox
So, what you need to do is add code to the trigger that disables it, and then creates a temporary timer that will enable it after a set amount of time. Like this:

Code: Select all

disableTrigger("My Trigger Name Here")
tempTimer(60, function () enableTrigger("My Trigger Name Here") end)
In the code above, the "60" is the number of seconds until the timer goes off, so adjust as necessary. The "My Trigger Name Here" has to be the exact name of the trigger, complete with proper capitalization and such.

Re: How do I top a trigger for going off multiple times in a row?

Posted: Sun Feb 11, 2018 10:02 pm
by raksasas
Nice, Thank you. I found something about the enable/disable trigger but was not sure how to use it.

Now that brings up another question. Where do I put it? I am currently just using the "Send Plain text" field with my triggers

Re: How do I top a trigger for going off multiple times in a row?

Posted: Sun Feb 11, 2018 10:20 pm
by Jor'Mox
You will notice a big blank box below all of that. That is where you put the code. I don't honestly know if you can combine the "send plain text" bit with actual code. To avoid any issues, I would recommend deleting what is in the send plain text box, and putting what was there in this bit of code, which would also need to go in the big blank box, along with the other two lines:

Code: Select all

send("my command here")
The order of the lines of code shouldn't matter, so just put them all in there however you prefer.

Re: How do I top a trigger for going off multiple times in a row?

Posted: Tue Feb 13, 2018 2:08 am
by raksasas
I tried it out last night. I had to work out a couple of things but it appears to be working. I didn't say on long to do some long testing to make sure.

Thank you Jor'Mox

Re: How do I top a trigger for going off multiple times in a row?

Posted: Fri Feb 23, 2018 3:25 am
by raksasas
For the most part this appears to be working. It seem to be doing some sort phantom triggers tho. It triggers on the matched pattern and does the:
command
disabletrigger
wait 30 seconds
enable trigger

After the said wait time and enable triger the first line that appears that comes up the command is sent again. It doesn't even match the pattern. just whatever pops up after the 30 seconds it just goes off. I am not sure if it is going through the whole disable trigger/wait/enable tigger process again. I do know it throws the command again on whatever the next incoming line is.