Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sat Apr 26, 2008 12:15 am   

Hrmm... Pattern not matching
 
Pattern:


Yitachi's shocking bite <<< ERADICATES >>> a viper fish!


Trigger...

Code:

#regex OPDamage_Convert {^([\w'+]) (acidic bite|beating|bite|blast|charge|chill|chop|claw|cleave|crush|divine|drain|flame|flaming bite|freezing bite|grep|magic|peck|pierce|pound|punch|scratch|shocking bite|shock|slap|slash|slice|slime|smash|stab|sting|suction|thrust|thwack|whip|wrath|polevault kick|kick|flamestrike|spell|flame)(?: does)? (misses|maims|scratches|grazes|hits|injures|wounds|mauls|decimates|devastates|maims|MUTILATES|DISEMBOWELS|DISMEMBERS|MASSACRES|MANGLES|\*\*\* DEMOLISHES \*\*\*|\*\*\* DEVASTATES \*\*\*|=== OBLITERATES ===|>>> ANNIHILATES <<<|<<< ERADICATES >>>|GHASTLY|HORRID|DREADFUL|HIDEOUS|INDESCRIBABLE|UNSPEAKABLE)(?: things to)?(?: a|the|A|The)? (.+)[!\.])}
{
$OPDmg_Val=%2
$OPDmg=" "
#switch ($OPDmg_Val)
  ("misses") {$OPDmg=0}
  ("scratches") {$OPDmg=2.5}
  ("grazes") {$OPDmg=6.5}
  ("hits") {$OPDmg=10.5}
  ("injures") {$OPDmg=14.5}
  ("wounds") {$OPDmg=18.5}
  ("mauls") {$OPDmg=22.5}
  ("decimates") {$OPDmg=26.5}
  ("devastates") {$OPDmg=30.5}
  ("maims") {$OPDmg=34.5}
  ("MUTILATES") {$OPDmg=38.5}
  ("DISEMBOWELS") {$OPDmg=42.5}
  ("DISMEMBERS") {$OPDmg=46.5}
  ("MASSACRES") {$OPDmg=50.5}
  ("MANGLES") {$OPDmg=54.5}
  ("*** DEMOLISHES ***") {$OPDmg=58.5}
  ("*** DEVASTATES ***") {$OPDmg=68}
  ("=== OBLITERATES ===") {$OPDmg=88}
  (">>> ANNIHILATES <<<") {$OPDmg= 112}
  ("<<< ERADICATES >>>") {$OPDmg=136}
  ("GHASTLY") {$OPDmg=163}
  ("HORRID") {$OPDmg=188}
  ("DREADFUL") {$OPDmg=228}
  ("HIDEOUS") {$OPDmg=238}
  ("INDESCRIBABLE") {$OPDmg=263}
  ("UNSPEAKABLE") {$OPDmg=280}

  #switch ($OPDmg <= 34.5) {#sayadd { <color #CCCCCC> ~(<color @Pcolor1>$OPDmg</color><color #CCCCCC>~) dmg </color>}}
     (($OPDmg > 34.5) AND ($OPDmg <= 54.5)) {#sayadd {<color #CCCCCC>~(<color @Pcolor2>$OPDmg</color><color #CCCCCC>~) dmg </color>}}
     (($OPDmg > 54.5) AND ($OPDmg <= 136)) {#sayadd { <color #CCCCCC>~(<color @Pcolor3>$OPDmg</color><color #CCCCCC>~) dmg </color>}}
     (($OPDmg >= 163) AND ($OPDmg <= 280)) {#sayadd { %ansi(blink)<color #CCCCCC> ~(<color @Pcolor3>$OPDmg</color><color #CCCCCC>~) dmg </color>%ansi(none)}}

} {General Triggers|Damage Calculator}



Supposed to the catch the damage of other players. In case I'm watching a gladiator match or what not.
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sat Apr 26, 2008 1:44 am   
 
You must have hit enter after ERADICATES because it wraps to the next line. It shouldn't wrap there, which is why it isn't matching.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sat Apr 26, 2008 1:50 am   
 
Doh!

Edit:

hrmm... not showing up as that in notepad. I dont know why it did on here.
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sat Apr 26, 2008 1:52 am   
 
Notepad is funky, which is why you should use a better editor or maximize notepad and turn off word wrapping to check.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sat Apr 26, 2008 2:08 am   
 
Word wrapping isn't on, I made sure. Smile
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sat Apr 26, 2008 2:12 am   
 
second try:

Code:

#regex OPDamage_Convert {^([\w'+]) (acidic bite|beating|bite|blast|charge|chill|chop|claw|cleave|crush|divine|drain|flame|flaming bite|freezing bite|grep|magic|peck|pierce|pound|punch|scratch|shocking bite|shock|slap|slash|slice|slime|smash|stab|sting|suction|thrust|thwack|whip|wrath|polevault kick|kick|flamestrike|spell|flame)(?: does)? (misses|maims|scratches|grazes|hits|injures|wounds|mauls|decimates|devastates|maims|MUTILATES|DISEMBOWELS|DISMEMBERS|MASSACRES|MANGLES|\*\*\* DEMOLISHES \*\*\*|\*\*\* DEVASTATES \*\*\*|=== OBLITERATES ===|>>> ANNIHILATES <<<|<<< ERADICATES >>>|GHASTLY|HORRID|DREADFUL|HIDEOUS|INDESCRIBABLE|UNSPEAKABLE)(?: things to)?(?: a|the|A|The)? (.+)[!\.])}
{
$OPDmg_Val=%2
$OPDmg=" "
#switch ($OPDmg_Val)
  ("misses") {$OPDmg=0}
  ("scratches") {$OPDmg=2.5}
  ("grazes") {$OPDmg=6.5}
  ("hits") {$OPDmg=10.5}
  ("injures") {$OPDmg=14.5}
  ("wounds") {$OPDmg=18.5}
  ("mauls") {$OPDmg=22.5}
  ("decimates") {$OPDmg=26.5}
  ("devastates") {$OPDmg=30.5}
  ("maims") {$OPDmg=34.5}
  ("MUTILATES") {$OPDmg=38.5}
  ("DISEMBOWELS") {$OPDmg=42.5}
  ("DISMEMBERS") {$OPDmg=46.5}
  ("MASSACRES") {$OPDmg=50.5}
  ("MANGLES") {$OPDmg=54.5}
  ("*** DEMOLISHES ***") {$OPDmg=58.5}
  ("*** DEVASTATES ***") {$OPDmg=68}
  ("=== OBLITERATES ===") {$OPDmg=88}
  (">>> ANNIHILATES <<<") {$OPDmg= 112}
  ("<<< ERADICATES >>>") {$OPDmg=136}
  ("GHASTLY") {$OPDmg=163}
  ("HORRID") {$OPDmg=188}
  ("DREADFUL") {$OPDmg=228}
  ("HIDEOUS") {$OPDmg=238}
  ("INDESCRIBABLE") {$OPDmg=263}
  ("UNSPEAKABLE") {$OPDmg=280}

  #switch ($OPDmg <= 34.5) {#sayadd { <color #CCCCCC> ~(<color @Pcolor1>$OPDmg</color><color #CCCCCC>~) dmg </color>}}
     (($OPDmg > 34.5) AND ($OPDmg <= 54.5)) {#sayadd {<color #CCCCCC>~(<color @Pcolor2>$OPDmg</color><color #CCCCCC>~) dmg </color>}}
     (($OPDmg > 54.5) AND ($OPDmg <= 136)) {#sayadd { <color #CCCCCC>~(<color @Pcolor3>$OPDmg</color><color #CCCCCC>~) dmg </color>}}
     (($OPDmg >= 163) AND ($OPDmg <= 280)) {#sayadd { %ansi(blink)<color #CCCCCC> ~(<color @Pcolor3>$OPDmg</color><color #CCCCCC>~) dmg </color>%ansi(none)}}

} {General Triggers|Damage Calculator}
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sat Apr 26, 2008 2:14 am   
 
third...

Code:

^([\w'+]) (acidic bite|beating|bite|blast|charge|chill|chop|claw|cleave|crush|divine|drain|flame|flaming bite|freezing bite|grep|magic|peck|pierce|pound|punch|scratch|shocking bite|shock|slap|slash|slice|slime|smash|stab|sting|suction|thrust|thwack|whip|wrath|polevault kick|kick|flamestrike|spell|flame)(?: does)? (misses|maims|scratches|grazes|hits|injures|wounds|mauls|decimates|devastates|maims|MUTILATES|DISEMBOWELS|DISMEMBERS|MASSACRES|MANGLES|\*\*\* DEMOLISHES \*\*\*|\*\*\* DEVASTATES \*\*\*|=== OBLITERATES ===|>>> ANNIHILATES <<<|<<< ERADICATES >>>|GHASTLY|HORRID|DREADFUL|HIDEOUS|INDESCRIBABLE|UNSPEAKABLE)(?: things to)?(?: a|the|A|The)? (.+)[!\.])


It's not note pad I don't think, it's something in the code format. Just too long of a line I suppose.
Reply with quote
gamma_ray
Magician


Joined: 17 Apr 2005
Posts: 496

PostPosted: Sat Apr 26, 2008 3:40 am   
 
It's wrapping here because that's the last space before a "word" (collection of characters with no spaces) that would go past the end of the line. Why it's actually wrapping inside code tags, I've no clue.

The reason why it's not matching is because the + needs to go outside the bracket right at the beginning
^([\w'+])
should be
^([\w']+)
and also there's an extraneous ) at the very end
[!\.])}
should be
[!\.]}
and finally, although this isn't causing errors but should be fixed anyway, you don't need to escape the . character inside a character set, so
[!\.]
should be
[!.]

Several of these have been pointed out to you already, I can only say again that you need to slow down and take things one step at a time, with lots and lots of attention to details.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sat Apr 26, 2008 4:41 am   
 
Hrmm... thanks.

Now I just need to find a way to capture names, not everything else.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sat Apr 26, 2008 1:12 pm   
 
Oh! I know... how do I make it not fire on a certain word... so like

(.+) but not "you" which would imply that the target is fighting a different mob, not myself and cannot be the "enemy" mob.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4799
Location: Pensacola, FL, USA

PostPosted: Sat Apr 26, 2008 8:46 pm   
 
[^you] isnt it?

I was close

{^string} do not match the specified string
_________________
Discord server
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sat Apr 26, 2008 9:03 pm   
 
Am testing it out. Thanks.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sat Apr 26, 2008 9:20 pm   
 
{^string} works by putting in a negative lookahead and a negative lookbehind, but you should, in most circumstances, be able to get away with just the lookahead, if you're using a regex.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sat Apr 26, 2008 10:30 pm   
 
hrmmm... why does the regex site say [^word]

I checked because:
Code:

{^(?:[\w']+{^Your}) (roundhouse|acidic bite|beating|bite|blast|charge|chill|chop|claw|cleave|crush|divine|drain|flame|flaming bite|freezing bite|grep|magic|peck|pierce|pound|punch|scratch|shocking bite|shock|slap|slash|slice|slime|smash|stab|sting|suction|thrust|thwack|whip|wrath|polevault kick|kick|flamestrike|spell|flame)(?: does)? (misses|maims|scratches|grazes|hits|injures|wounds|mauls|decimates|devastates|maims|MUTILATES|DISEMBOWELS|DISMEMBERS|MASSACRES|MANGLES|\*\*\* DEMOLISHES \*\*\*|\*\*\* DEVASTATES \*\*\*|=== OBLITERATES ===|>>> ANNIHILATES <<<|<<< ERADICATES >>>|GHASTLY|HORRID|DREADFUL|HIDEOUS|INDESCRIBABLE|UNSPEAKABLE)(?: things to)?(?: a|the|A|The)? ({^you}.+)[!.]}
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sat Apr 26, 2008 11:56 pm   
 
It doesn't say [^word], it says [^range]. [^hax] is the opposite of [hax]. [hax] means "match h, a, or x" - [^hax] means "match anything but h, a and x". So while [^you]+ would work to exclude the word "you", it would also exclude any other option containing y, o, or u, which isn't what you want. So for this, you use a negative lookahead, for which I think the syntax is (?!you), but don't quote me on that. Lookaheads are zero-width (if you take them out, the remaining regex still has to match the line), but whatever regex is between the (?! and the ) is applied to the characters that come after that point. If a normal lookahead matches, it's counted as a match, and if it doesn't, the result's rejected. Since this is a negative lookahead, the line is rejected if the regex in the lookahead matches, and accepted if the lookahead doesn't match. So (?!you)(.*) would mean "look ahead and see if the next word is "you". If it is, reject. If it's not, capture it".
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Apr 27, 2008 12:36 am   
 
So it has to go before the capture?

Code:

^(?!Your)(?:[\w']+) (roundhouse|acidic bite|beating|bite|blast|charge|chill|chop|claw|cleave|crush|divine|drain|flame|flaming bite|freezing bite|grep|magic|peck|pierce|pound|punch|scratch|shocking bite|shock|slap|slash|slice|slime|smash|stab|sting|suction|thrust|thwack|whip|wrath|polevault kick|kick|flamestrike|spell|flame)(?: does)? (misses|maims|scratches|grazes|hits|injures|wounds|mauls|decimates|devastates|maims|MUTILATES|DISEMBOWELS|DISMEMBERS|MASSACRES|MANGLES|\*\*\* DEMOLISHES \*\*\*|\*\*\* DEVASTATES \*\*\*|=== OBLITERATES ===|>>> ANNIHILATES <<<|<<< ERADICATES >>>|GHASTLY|HORRID|DREADFUL|HIDEOUS|INDESCRIBABLE|UNSPEAKABLE)(?: things to)?(?: a|the|A|The)? (?!you)(.+)[!.]


Last edited by chamenas on Sun Apr 27, 2008 12:50 am; edited 1 time in total
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sun Apr 27, 2008 12:49 am   
 
Well, yeah, since it's a lookahead. You could put it after, but you'd have to use a lookbehind.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Apr 27, 2008 12:50 am   
 
I just posted the pattern I'm using.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sun Apr 27, 2008 12:58 am   
 
Yeah, that should be it. Quick test sample to show the lookahead at work:

#regex {test: (?!your)\w+} {#say lolz}
#say test: something
#say test: your
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Apr 27, 2008 1:33 am   
 
Yeah, it worked. Unfortunately also need to add something for the possibility of preceeding text for watching gladiator matches.

Think I'll work on the damage type stringlist first though. Any links would be lovely.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sun Apr 27, 2008 1:44 am   
 
Well, if you sometimes want to have the "you" in there, remove the lookahead and do some post-processing with #if - check if %1 is "you", and check a variable to see if you're watching gladiators, and go from there.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Apr 27, 2008 4:41 am   
 
The you is already covered by a separate trigger, the thought being that I will have separate damage counts for different things. I've yet to figure out how to do it if I have more than one pet or more than one ally fighting with me.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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