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
Ambelghan
Novice


Joined: 04 Apr 2010
Posts: 49

PostPosted: Sun Apr 04, 2010 6:15 am   

How do you use the the OR operator in triggers
 
Hi, I loved zMUD thought I would like cMUD and it is starting to be a massive hassle. Before I could just
Code:
#TRIGGER{*match1*|*match2*|*match3*} {do what I want}
I tried
Code:
#TRIGGER{*match1*||*match2*||*match3*} {do what I want}
and that doesn't work. Is there no way to do this in cMUD? There an easier way to highlight the text when someone says something (says, asks, ect)?
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sun Apr 04, 2010 6:59 am   
 
You need to do #TRIGGER {{*match1*|*match2*|*match3*}}, not #TRIGGER {*match1*|*match2*|*match3*}

Note the doubling of the brackets. {} within a trigger pattern means a group of things to check for. You might be better off, though, putting what you want to match into a variable, then doing #TRIGGER {{@@variable}} so it doesn't get so messy.

Charneus
Reply with quote
Danlo
Magician


Joined: 28 Nov 2003
Posts: 313
Location: Australia

PostPosted: Sun Apr 04, 2010 7:18 am   
 
For starters, you do not need the * in your trigger pattern. The pattern will match if the words you're searching for appear anywhere in the line anyway. Secondly, to match an item in a string list, you need to put that string list inside curly brackets. Hence your trigger would look like:

#TRIGGER {{match1|match2|match3}} {do what I want}
Reply with quote
Ambelghan
Novice


Joined: 04 Apr 2010
Posts: 49

PostPosted: Sun Apr 04, 2010 9:12 am   
 
That worked, thank you for the prompt response.
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