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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
JustMe
Newbie


Joined: 16 May 2002
Posts: 8
Location: Estonia

PostPosted: Thu May 16, 2002 9:27 am   

Pattern matching...
 
I have the stringlist variable holding the patterns(i.e patterns = "tells you|shouts"). What i want is using #if test, if some string matches one of the patterns in that variable.
According to manual this should be:
#if {@SomeString =~ {@patterns} } {...}

The problem is, this solution works perfectly, but my zmud 6.16 says there's a syntax error in that line - is it 6.16 problem? or maybe i should use another syntax? Thanks
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Thu May 16, 2002 12:46 pm   
 
It's better to put the string list right int the pattern of the trigger. Example:
#TRIGGER{%w {@patterns} '*'} {do something}

Kjata
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu May 16, 2002 4:14 pm   
 
If putting the variable in the pattern won't work, the preferred method would be the %ismember function. Also, you should use (), not {}, for the #IF expression.
#IF (%ismember(@SomeString,@patterns)) {...}

LightBulb
Vague questions get vague answers
Reply with quote
Pega
Magician


Joined: 08 Jan 2001
Posts: 341
Location: Singapore

PostPosted: Fri May 17, 2002 6:15 pm   
 
You can do either way.

I use both trigger pattern and =~ pattern matching in my trigger for specific ANSI trigger with internal pattern triggering.

Do it like this:
#if {@SomeString =~ "{@patterns}"} {...}
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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