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

Post Reply
raksasas
Posts: 3
Joined: Sun Feb 11, 2018 4:21 pm

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

Post by raksasas » Sun Feb 11, 2018 5:33 pm

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

Jor'Mox
Posts: 859
Joined: Wed Apr 03, 2013 2:19 am

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

Post by Jor'Mox » Sun Feb 11, 2018 8:46 pm

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.

raksasas
Posts: 3
Joined: Sun Feb 11, 2018 4:21 pm

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

Post by raksasas » Sun Feb 11, 2018 10:02 pm

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

Jor'Mox
Posts: 859
Joined: Wed Apr 03, 2013 2:19 am

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

Post by Jor'Mox » Sun Feb 11, 2018 10:20 pm

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.

raksasas
Posts: 3
Joined: Sun Feb 11, 2018 4:21 pm

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

Post by raksasas » Tue Feb 13, 2018 2:08 am

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

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests