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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Wed Sep 15, 2010 7:34 pm   

%match function
 
I am trying to use the %match function with a stringlist but I can't get it to work. I am not sure if I found a bug or I am not matching it correctly. The link below is the post to the issue. If I could get a guru to look at this post it would be greatly appreciated.

http://forums.zuggsoft.com/forums/viewtopic.php?t=35822
_________________
Run as hard as a wild beast if you will, but you won't get any reward greater than that destined for you.
Source: (Egyptian)
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Sep 15, 2010 7:59 pm   
 
From the other post:
Quote:
#IF (%match(%i,"^(@stutterlist)*",$matched)) {

Remember that in CMUD, @variables are NOT EXPANDED WITHIN " QUOTES! Also, to match an OR-list in a pattern, you need to put {} around the list. So if you want to expand the string list and pass it to the %match function, you need to do this:
Code:
#IF (%match(%i,%concat("^({",@stutterlist,"})*"),$matched)) {

Trigger patterns automatically compile their pattern and expand string lists, etc. But the %match (or %regex) functions do not...they just take a simple string argument for the pattern.
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Wed Sep 15, 2010 8:24 pm   
 
Thanks Zugg!!! I thought I tried that before. I just checked it and I had the parenthesis and {} backwards.

How about making sure the "th" matches on a word instead of "t". I thought that would fix my problem but it doesn't. :(
_________________
Run as hard as a wild beast if you will, but you won't get any reward greater than that destined for you.
Source: (Egyptian)
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Thu Sep 16, 2010 4:29 pm   
 
You might want to use %regex instead of %match and then use regular expression wildcards such as \b to match word boundaries. Or, in the CMUD pattern within %match you should be able to use %q for word boundaries.
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Thu Sep 16, 2010 4:31 pm   
 
Thanks. I tried the script again and the match does work. I might have been using a copy of my script that was causing the issue. I'll have to remove the backup to make sure I don't do it again. :)
_________________
Run as hard as a wild beast if you will, but you won't get any reward greater than that destined for you.
Source: (Egyptian)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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