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


Joined: 23 May 2003
Posts: 31

PostPosted: Thu Nov 27, 2003 12:32 am   

Pattern Matching
 
Is there a way to get a trigger to recognize a pattern starting with a "!" ?
Here is the idea:
#IF (%2 == "~!page") {blah} {blah}
It doesnt seem to work begining with the "!" mark, but if I remove it and just have "page" it works like a charm. Is there a trick to this?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Nov 27, 2003 12:52 am   
 
1)ZMud does not use the == operator. Everything that requires == uses =.

2)ZMud does not execute pattern-matching via the =, use =~ instead. IE, %2 =~ "!page"

NOTE: the next public version of ZMud introduces a new function to make pattern-matching much more intuitive and easy. I don't know if Zugg is retaining the =~ operator or not, though.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Nov 27, 2003 6:00 am   
 
#TR {test (%x)} {#IF ("%1" = "!page") {blah} {I'm sure I could think of something more interesting than "blah"}}
Reply with quote
Darkmere
Novice


Joined: 23 May 2003
Posts: 31

PostPosted: Fri Nov 28, 2003 3:27 am   
 
The ~ was an attempt to recognize the ! in the case it was a special character.
The == works just the same as = in my applications, and unless it is an absolute /must/ then I'm not going to go through all my triggers and change them. They work for now.

Thanks LightBulb, the trick was the "" around the %2.

-Darkmere
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Nov 28, 2003 6:29 pm   
 
The == syntax is supported if not well documented. It was implemented a long time ago to ease us poor C programmers used to using == for comparison.
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