|
Darkmere Novice
Joined: 23 May 2003 Posts: 31
|
Posted: 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? |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: 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. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: 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"}}
|
|
|
|
Darkmere Novice
Joined: 23 May 2003 Posts: 31
|
Posted: 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 |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: 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.
|
|
|
|
|
|