Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
atraeyu
Novice


Joined: 29 Dec 2006
Posts: 41
Location: Chester, VT

PostPosted: Sat Dec 15, 2007 12:55 am   

Triggers: Matching Multiple Patterns
 
I'm trying to make a trigger execute when it encounters more than one phrase, I made a test trigger to test it out.
If I set the pattern to "triggertestone" when the mud sends me the text "triggertestone" I see that it executes.
Now, if I set the pattern to "triggertestone|triggertesttwo" neither phrase will call it to execute.
I also tried "(triggertestone|triggertesttwo)" and "*triggertestone*|*triggertesttwo*" without any success.

Anyone know how to do this correctly? Thanks.
Reply with quote
Vesence
Beginner


Joined: 12 Mar 2006
Posts: 22

PostPosted: Sat Dec 15, 2007 1:06 am   
 
#Trigger {Triggertestone|TriggerTesttwo} {#say I'm firing on either pattern}

You need to surround your multiple patterns in {}.

I believe this is in the documentation, which is a great thing to read.
_________________
Achaea
Reply with quote
atraeyu
Novice


Joined: 29 Dec 2006
Posts: 41
Location: Chester, VT

PostPosted: Sat Dec 15, 2007 1:18 am   
 
Sorry, I couldn't find it in the documentation (not under #TRIGGER in commands, anyway). I did look first, I just couldn't seem to find the answer. :( Thank you though, it does work!
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sat Dec 15, 2007 8:37 am   
 
Vesence actually means #Trigger {{Triggertestone|TriggerTesttwo}} {#say I'm firing on either pattern} since the outside set of braces will be parsed out when CMUD runs the #trig command. But braces are what you use, yes.

The list of pattern-matching syntax, just for future information, is here.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Sat Dec 15, 2007 9:24 am   
 
Fang, could you copy-paste your sample to the Pattern Matching page, please? Match
_________________
My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sat Dec 15, 2007 9:56 am   
 
That example's pretty simple, and there's already a simple on that example page. I don't think it needs further explanation.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Sat Dec 15, 2007 3:53 pm   
 
Fang: It's not my intent to beat you over the head or step on your toes here, but I don't see an example on the Pattern Matching page that specifically addresses the matching of multiple patterns. This is the totality of what I see there on the subject:
Code:
{val1|val2|val3|...} match any of the specified strings can not use other wildcard inside this


Your example is quite simple and therefore perfectly suited for inclusion as an example on the matter. Furthermore, a second example showing the pattern matching syntax and capture of the string from a string list #VAR would also be appropriate for that page in my opinion.

Heh! If it were up to me, I'd like to see examples of most of the wildcards on that page and move the &VAR examples to a separate page and just link it from that page. &VAR is great but it doesn't really expand on the bulk of the information listed at the top of the page.

Anyway, just thought I'd mention that Arde's request made sense to me.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sat Dec 15, 2007 6:48 pm   
 
Hey, I'm always willing to hear criticism, especially the well-thought-out kind :)

As you can tell from my comments on that article, there're numerous things that need expansion in it. It's one of those articles from zMUD that's been through a number of different help systems and so the formatting's pretty naff - really it needs rewriting from scratch to make adding and changing things easier. I've wanted to add things like regex equivalents to that article for a while, and I guess a simple example of each wouldn't hurt either.

I'll give some thought over the holidays to making this article better, definitely.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
atraeyu
Novice


Joined: 29 Dec 2006
Posts: 41
Location: Chester, VT

PostPosted: Sat Dec 15, 2007 7:59 pm   
 
Perhaps ... a link to that page in the #TRIGGER documentation would be helpful, too :)
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Sat Dec 15, 2007 11:16 pm   
 
mr_kent
Thank you for your post! Smile

If people ask about something pretty simple, they did not get enough help from existing articles as they should.

Fang Xianfu
I know that it is awfully boring to add various stuff here... there... endlessly... but your examples are so good. Wink
_________________
My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net