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
whodatjerk
Newbie


Joined: 10 Sep 2003
Posts: 4
Location: USA

PostPosted: Mon Jun 14, 2004 3:51 pm   

limiting the width of the pattern
 
was wondering if anyone could help me with this. I created a trigger that depends on many * expressions. Because of this it's capturing more than it should. What i wanted to know is if there is a way to set limits on the trigger so that it will only detect the specific pattern if it is a certain length in characters? I found the &nn pattern matching but wasn't sure how to use it for a whole message pattern.
Reply with quote
jessew
Apprentice


Joined: 03 Mar 2003
Posts: 141

PostPosted: Mon Jun 14, 2004 5:01 pm   
 
&nn is a fixed width pattern meaning it would have to be exactly &nn characters long. No more no less. This isn't what your looking for. One way of solving your problem would to put a conditional in the command section of your trigger that checks the line's length before acting on it.
Just an EXAMPLE trigger

#TRIGGER {blah * blah *} {#IF (%len(%trigger) < 100) {DO WHAT YOU WANT TO DO}}


What it does is first checks if the line that fired your trigger is less then 100 chars before running the command.

But if you want to post what your trying to do I'm sure theres an even a better way to go about it.

Cheers, Jesse
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Jun 14, 2004 6:23 pm   
 
&nn might be exactly what you're looking for. Without details there's no way to tell.

However, in most cases it's easier to create a suitable pattern using other wildcards. * matches more than any other wildcard, so if * is matching too much the first thing you should do is consider using more limited wildcards.

You should also keep in mind that there is no requirement to match an entire line. If all you need is a small, identifiable section in the middle of the line then that's all you need in your pattern. Trying to match everything before and after that section frequently creates unnecessary difficulties.

As Jesse says, we could provide more assistance if we had a better idea what you're trying to do.
Reply with quote
whodatjerk
Newbie


Joined: 10 Sep 2003
Posts: 4
Location: USA

PostPosted: Mon Jun 14, 2004 11:46 pm   
 
well, basically they're the new paralysis messages from Achaea.

A pri*l* stinging overcomes your bod*, fading away into numbness.

All the varying messages are exactly 65 chars long and involve three (*) expressions. One (*) expression replaces two characters/spaces while the other two (*) take up only one char/space for a total of 4 chars replaced.

I'm surprised no one posted here for help on this yet and it took me awhile before i posted because i wanted to figure it out myself heh...but i'm finally admitting to myself that i suck and can't code it. let me know what you guys think. thanks.
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