Trigger and wilcard questions

Post Reply
Nilats
Posts: 11
Joined: Mon Aug 03, 2020 1:16 am

Trigger and wilcard questions

Post 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")

User avatar
demonnic
Posts: 720
Joined: Sat Dec 05, 2009 3:19 pm

Re: Trigger and wilcard questions

Post by demonnic »

You've set the trigger types to 'perl regex' yes?

Nilats
Posts: 11
Joined: Mon Aug 03, 2020 1:16 am

Re: Trigger and wilcard questions

Post by Nilats »

Ya I had it as perl regex! I had to deconstruct everything and retry it and it worked. Thanks!

User avatar
demonnic
Posts: 720
Joined: Sat Dec 05, 2009 3:19 pm

Re: Trigger and wilcard questions

Post by demonnic »

Glad you got it sorted out in the end =)

Nilats
Posts: 11
Joined: Mon Aug 03, 2020 1:16 am

Re: Trigger and wilcard questions

Post 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

User avatar
demonnic
Posts: 720
Joined: Sat Dec 05, 2009 3:19 pm

Re: Trigger and wilcard questions

Post 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])

User avatar
SlySven
Posts: 994
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Trigger and wilcard questions

Post 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]...

Post Reply