|
Asilient_1 Apprentice
Joined: 26 Apr 2007 Posts: 113
|
Posted: Mon Oct 08, 2007 4:51 pm
Quick question about triggers (1.34) |
Okay, I decided to dabble in multiline triggers once more as I did in Zmud just to reduce the spam I get from my MUD. Part of which is multilines.
Code: |
^You take a drink from (\D+)\.\nH\:(\d+) |
This should gag "you take a drink from.." And echo back my specified message. However, I normally gag..
Code: |
^You take a drink from (*).$ |
When the second pattern is disabled, the first works fine. When it is enabled, it doesn't work at all? I've tried playing with priorities some, but to no ultimate effect. I always thought Cmud parsed lines regardless of if they are gagged or not, so thought this would be a non-issue. It seems it is, though.
Any help would be appreciated. :(
Oh, I have tried playing with the trigger priorities a bit to no avail, so would welcome further advice on what I can do to get the result I want.
EDIT: Also, the first pattern is REGEX because:
Code: |
^You take a drink from (*).$H: |
Wouldn't compile "Invalid local variable H". |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Oct 08, 2007 5:31 pm |
Don't use multiline triggers - they're presumably only still around for compatability given that multistate triggers can do what they can much more simply.
So, with that said, use a multistate trigger.
#trig {^You take a drink from} {}
#cond {^H~:} {#gag 2} {within|param=1}
Or perhaps a single #gag in each trigger state.
The (*)$ part is superfluous in a single trigger, since it's going to match everything until the end of the line.
The reason the H: wasn't working is because the colon wasn't escaped. Escaping it as I have should start it working again.
Finally, why have two triggers for the same thing, anyway? With the logic added to the multistate trigger, you'll keep all your code related to that event in one place and speed up matching. |
|
|
|
Asilient_1 Apprentice
Joined: 26 Apr 2007 Posts: 113
|
Posted: Mon Oct 08, 2007 5:42 pm |
I've never, ah.. actually played with multistates before. It has mostly been multilining for me. (A habit carried over from Zmud.)
|
|
|
|
|
|
|
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
|
|