[MudWalker] Trigger formatting

Kevin Reid kpreid at mac.com
Mon Jan 14 10:17:06 PST 2008


On Jan 11, 2008, at 12:56, Damon G wrote:

> So here is my HP bar:
>
>  HP:470/470 C:100%  NRG:180/180(6)  SP:66/117  B:1(81%) G2N:3k
...
> Trigger:
> SP:^(.*)

"^" means match the beginning of the line. This pattern can never match.

"SP:(.*)" would match, but it would include the rest of the line.

You want something like "\bSP:(\d+)". \b means to require that it's a  
word boundary (e.g. this will not match "WASP:42"), and \d matches  
only digits, so it will stop before the "/".

Now, if you want to avoid spoofing, i.e. if someone does

   Wiseguy says, "  SP:0/117  "

then you will want to write a pattern which matches the entire line.  
Here's an example; you may need to adjust it depending on what parts  
actually change. Note that the only unescaped ("(x)" rather than "\(x 
\)") parentheses are around the part you're interested in.

^ *HP:\d+/\d+ +C:\d+% +NRG:\d+/\d+\(\d+\) +SP:(\d+)/\d+ B:\d+\(\d+%\)  
+G2N:(\d+)k *$

(This will probably get wrapped in the mail, so you'll need to delete  
the hard line break for it to work properly as a trigger pattern.)

-- 
Kevin Reid                            <http://homepage.mac.com/kpreid/>




More information about the MudWalker mailing list