Page 1 of 1

Trigger and wilcard questions

Posted: Thu Oct 22, 2020 6:16 pm
by Nilats
I've tried creating a trigger to order followers to bash when something bumps into a wall, then turn off, but i cant seem to get either one to fire:

^(A|An) (.+) bumps into a massive wall of iron...
send("order followers bash " .. matches[3])
disableTrigger("Wall Bump")

I also tried:

^Oof! a (\w+) bumps into a massive wall of iron...
send("order followers bash " .. matches[2])
disableTrigger("Wall Bump")

Re: Trigger and wilcard questions

Posted: Thu Oct 22, 2020 7:22 pm
by demonnic
You've set the trigger types to 'perl regex' yes?

Re: Trigger and wilcard questions

Posted: Thu Oct 22, 2020 8:05 pm
by Nilats
Ya I had it as perl regex! I had to deconstruct everything and retry it and it worked. Thanks!

Re: Trigger and wilcard questions

Posted: Thu Oct 22, 2020 8:09 pm
by demonnic
Glad you got it sorted out in the end =)

Re: Trigger and wilcard questions

Posted: Fri Oct 23, 2020 2:50 am
by Nilats
Thanks for taking the time to answer!

I do have one i can't figure out.

Trigger( from zmud) would be:

A %1 has set off your frost beacon at %2
An %1 has set off your frost beacon at %2


Response: say %1 tripped beacon at %2

Re: Trigger and wilcard questions

Posted: Fri Oct 23, 2020 1:20 pm
by demonnic
pattern would be

(?:A|An) (.+) has set off your frost beacon at (.+)

and code would be

send("say " .. matches[2] .. " tripped beacon at " .. matches[3])

Re: Trigger and wilcard questions

Posted: Tue Nov 03, 2020 10:20 am
by SlySven
Could that not be made even simpler as:

An? (.+) has set off your frost beacon at (.+)

Also - you might want to watch out for terminal punctuation - the matches[3] will - as it is written - also include a full stop if the MUD puts one on the end of the sentence, if it always does that then you can use:

An? (.+) has set off your frost beacon at (.+)\.

to exclude it (the '\' converts that last '.' to be a full-stop and not a match any single character) - and with it being outside of the '(' ... ')' it will not be included in matches[3]...