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 Goto page 1, 2  Next
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri May 09, 2008 12:17 pm   

Some Pattern Fun
 
So, going off Old Guy's suggestion, I've made the ugly beast of 4 patterns into one:

Code:

#regex Damage_Convert {^(?>\[[^\]]*\] )?(?:Your|A|The|a|the|An)? (?:[\w']+(?: [\w']+(?: [\w']+)?)?)? (@attack_type)(?: does)? (@damage_type)(?: things to)?(?: a|the|A|The)? (\w+( \w+( \w+)?)?)[!\.]$}
{
  $Dmg_Val=%2
  $Dmg=" "
  #switch ($Dmg_Val)
    ("misses") {$Dmg=0}
    ("scratches") {$Dmg=2.5}
    ("grazes") {$Dmg=6.5}
    ("hits") {$Dmg=10.5}
    ("injures") {$Dmg=14.5}
    ("wounds") {$Dmg=18.5}
    ("mauls") {$Dmg=22.5}
    ("decimates") {$Dmg=26.5}
    ("devastates") {$Dmg=30.5}
    ("maims") {$Dmg=34.5}
    ("MUTILATES") {$Dmg=38.5}
    ("DISEMBOWELS") {$Dmg=42.5}
    ("DISMEMBERS") {$Dmg=46.5}
    ("MASSACRES") {$Dmg=50.5}
    ("MANGLES") {$Dmg=54.5}
    ("*** DEMOLISHES ***") {$Dmg=58.5}
    ("*** DEVASTATES ***") {$Dmg=68}
    ("=== OBLITERATES ===") {$Dmg=88}
    (">>> ANNIHILATES <<<") {$Dmg= 112}
    ("<<< ERADICATES >>>") {$Dmg=136}
    ("GHASTLY") {$Dmg=163}
    ("HORRID") {$Dmg=188}
    ("DREADFUL") {$Dmg=228}
    ("HIDEOUS") {$Dmg=238}
    ("INDESCRIBABLE") {$Dmg=263}
    ("UNSPEAKABLE") {$Dmg=280}

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

} {General Triggers|Damage Calculator}


Here's what it's supposed to match, as you can see, it doesn't match them all:

Your flaming bite misses a creature! (0) dmg
Your flaming bite misses a creature. (0) dmg
Your flaming bite grazes a creature!
Your flaming bite grazes a creature.
Your flaming bite DISEMBOWELS a creature! (42.5) dmg
Your flaming bite DISEMBOWELS a creature. (42.5) dmg
Your flaming bite *** DEVASTATES *** a creature! (68) dmg
Your flaming bite *** DEVASTATES *** a creature. (68) dmg
Your flaming bite does UNSPEAKABLE things to a creature! (280) dmg
Your flaming bite does UNSPEAKABLE things to a creature. (280) dmg
----------------------------------------------------------
Your crush misses a creature!
Your crush misses a creature.
Your crush grazes a creature!
Your crush grazes a creature.
Your crush DISEMBOWELS a creature!
Your crush DISEMBOWELS a creature.
Your crush *** DEVASTATES *** a creature!
Your crush *** DEVASTATES *** a creature.
Your crush does UNSPEAKABLE things to a creature!
Your crush does UNSPEAKABLE things to a creature.
-----------------------------------------------------------
A green forest treant's flaming bite misses a creature! (0) dmg
A green forest treant's flaming bite misses a creature. (0) dmg
A green forest treant's flaming bite grazes a creature!
A green forest treant's flaming bite grazes a creature.
A green forest treant's flaming bite DISEMBOWELS a creature! (42.5) dmg
A green forest treant's flaming bite DISEMBOWELS a creature. (42.5) dmg
A green forest treant's flaming bite *** DEVASTATES *** a creature! (68) dmg
A green forest treant's flaming bite *** DEVASTATES *** a creature. (68) dmg
A green forest treant's flaming bite does UNSPEAKABLE things to a creature! (280) dmg
A green forest treant's flaming bite does UNSPEAKABLE things to a creature. (280) dmg
----------------------------------------------------------
A green forest treant's crush misses a creature! (0) dmg
A green forest treant's crush misses a creature. (0) dmg
A green forest treant's crush grazes a creature!
A green forest treant's crush grazes a creature.
A green forest treant's crush DISEMBOWELS a creature! (42.5) dmg
A green forest treant's crush DISEMBOWELS a creature. (42.5) dmg
A green forest treant's crush *** DEVASTATES *** a creature! (68) dmg
A green forest treant's crush *** DEVASTATES *** a creature. (68) dmg
A green forest treant's crush does UNSPEAKABLE things to a creature! (280) dmg
A green forest treant's crush does UNSPEAKABLE things to a creature. (280) dmg
A forest treant's flaming bite misses a creature! (0) dmg
A forest treant's flaming bite misses a creature. (0) dmg
A forest treant's flaming bite grazes a creature!
A forest treant's flaming bite grazes a creature.
A forest treant's flaming bite DISEMBOWELS a creature! (42.5) dmg
A forest treant's flaming bite DISEMBOWELS a creature. (42.5) dmg
A forest treant's flaming bite *** DEVASTATES *** a creature! (68) dmg
A forest treant's flaming bite *** DEVASTATES *** a creature. (68) dmg
A forest treant's flaming bite does UNSPEAKABLE things to a creature! (280) dmg
A forest treant's flaming bite does UNSPEAKABLE things to a creature. (280) dmg
----------------------------------------------------------
A forest treant's crush misses a creature! (0) dmg
A forest treant's crush misses a creature. (0) dmg
A forest treant's crush grazes a creature!
A forest treant's crush grazes a creature.
A forest treant's crush DISEMBOWELS a creature! (42.5) dmg
A forest treant's crush DISEMBOWELS a creature. (42.5) dmg
A forest treant's crush *** DEVASTATES *** a creature! (68) dmg
A forest treant's crush *** DEVASTATES *** a creature. (68) dmg
A forest treant's crush does UNSPEAKABLE things to a creature! (280) dmg
A forest treant's crush does UNSPEAKABLE things to a creature. (280) dmg
-----------------------------------------------------------
A treant's flaming bite misses a creature! (0) dmg
A treant's flaming bite misses a creature. (0) dmg
A treant's flaming bite a creature!
A treant's flaming bite a creature.
A treant's flaming bite DISEMBOWELS a creature! (42.5) dmg
A treant's flaming bite DISEMBOWELS a creature. (42.5) dmg
A treant's flaming bite *** DEVASTATES *** a creature! (68) dmg
A treant's flaming bite *** DEVASTATES *** a creature. (68) dmg
A treant's flaming bite does UNSPEAKABLE things to a creature! (280) dmg
A treant's flaming bite does UNSPEAKABLE things to a creature. (280) dmg
----------------------------------------------------------
A treant's crush misses a creature! (0) dmg
A treant's crush misses a creature. (0) dmg
A treant's crush grazes a creature!
A treant's crush grazes a creature.
A treant's crush DISEMBOWELS a creature! (42.5) dmg
A treant's crush DISEMBOWELS a creature. (42.5) dmg
A treant's crush *** DEVASTATES *** a creature! (68) dmg
A treant's crush *** DEVASTATES *** a creature. (68) dmg
A treant's crush does UNSPEAKABLE things to a creature! (280) dmg
A treant's crush does UNSPEAKABLE things to a creature. (280) dmg
-----------------------------------------------------------
Irtia's flaming bite misses a creature!
Irtia's flaming bite misses a creature.
Irtia's flaming bite grazes a creature!
Irtia's flaming bite grazes a creature.
Irtia's flaming bite DISEMBOWELS a creature!
Irtia's flaming bite DISEMBOWELS a creature.
Irtia's flaming bite *** DEVASTATES *** a creature!
Irtia's flaming bite *** DEVASTATES *** a creature.
Irtia's flaming bite does UNSPEAKABLE things to a creature!
Irtia's flaming bite does UNSPEAKABLE things to a creature.
----------------------------------------------------------
Irtia's crush misses a creature!
Irtia's crush misses a creature.
Irtia's crush grazes a creature!
Irtia's crush grazes a creature.
Irtia's crush DISEMBOWELS a creature!
Irtia's crush DISEMBOWELS a creature.
Irtia's crush *** DEVASTATES *** a creature!
Irtia's crush *** DEVASTATES *** a creature.
Irtia's crush does UNSPEAKABLE things to a creature!
Irtia's crush does UNSPEAKABLE things to a creature.
-----------------------------------------------------------
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Fri May 09, 2008 12:21 pm   
 
Give us the XML for the trigger as you have it and the two variables that go with it. Just the variables would do, but the trigger would be convenient.
_________________
Rorso's syntax colouriser.

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


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri May 09, 2008 12:27 pm   
 
Code:

<trigger name="Damage_Convert" priority="1080" regex="true" id="108">
  <pattern>^(?>\[[^\]]*\] )?(Your|A|The|a|the|An)? (\w+( \w+( \w+)?)?) (@attack_type)(?: does)? (@damage_type)(?: things to)?(?: a|the|A|The)? (\w+( \w+( \w+)?)?)[!\.]$</pattern>
  <value><![CDATA[
  $Dmg_Val=%2
  $Dmg=" "
  #switch ($Dmg_Val)
    ("misses") {$Dmg=0}
    ("scratches") {$Dmg=2.5}
    ("grazes") {$Dmg=6.5}
    ("hits") {$Dmg=10.5}
    ("injures") {$Dmg=14.5}
    ("wounds") {$Dmg=18.5}
    ("mauls") {$Dmg=22.5}
    ("decimates") {$Dmg=26.5}
    ("devastates") {$Dmg=30.5}
    ("maims") {$Dmg=34.5}
    ("MUTILATES") {$Dmg=38.5}
    ("DISEMBOWELS") {$Dmg=42.5}
    ("DISMEMBERS") {$Dmg=46.5}
    ("MASSACRES") {$Dmg=50.5}
    ("MANGLES") {$Dmg=54.5}
    ("*** DEMOLISHES ***") {$Dmg=58.5}
    ("*** DEVASTATES ***") {$Dmg=68}
    ("=== OBLITERATES ===") {$Dmg=88}
    (">>> ANNIHILATES <<<") {$Dmg= 112}
    ("<<< ERADICATES >>>") {$Dmg=136}
    ("GHASTLY") {$Dmg=163}
    ("HORRID") {$Dmg=188}
    ("DREADFUL") {$Dmg=228}
    ("HIDEOUS") {$Dmg=238}
    ("INDESCRIBABLE") {$Dmg=263}
    ("UNSPEAKABLE") {$Dmg=280}

  #switch ($Dmg=0) {#sayadd { <color #CCCCCC>~(</color><color #2D2D00>$Dmg</color><color #CCCCCC>~) dmg </color>}}
     (($Dmg <= 34.5) AND ($Dmg <=0)) {#sayadd { <color #CCCCCC>~(</color><color @Pcolor1>$Dmg</color><color #CCCCCC>~) dmg </color>}}
     (($Dmg > 34.5) AND ($Dmg <= 54.5)) {#sayadd { <color #CCCCCC>~(</color><color @Pcolor2>$Dmg</color><color #CCCCCC>~) dmg </color>}}
     (($Dmg > 54.5) AND ($Dmg <= 136)) {#sayadd { <color #CCCCCC>~(</color><color @Pcolor3>$Dmg</color><color #CCCCCC>~) dmg </color>}}
     (($Dmg >= 163) AND ($Dmg <= 280)) {#sayadd { %ansi(blink)<color #CCCCCC>~(</color><color @Pcolor3>$Dmg</color><color #CCCCCC>~) dmg </color>%ansi(none)}}
]]></value>
</trigger>



attack_type:
Code:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <var name="attack_type" type="StringList">chomp|polevault kick|flame|spell|flamestrike|smash|lightning bolt|roundhouse|shock|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|kick</var>
</cmud>


damage type:
Code:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <var name="damage_type" type="StringList"><![CDATA[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]]></var>
</cmud>
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri May 09, 2008 12:42 pm   
 
Also of note:



A gnome stone excavator's slash mauls you.
Your beating DISMEMBERS a gnome stone excavator!
Your beating maims a gnome stone excavator!
A netherium great staff draws life from a gnome stone excavator.
Your beating MANGLES a gnome stone excavator!
A gnome stone excavator dodges your attack.
A netherium great staff draws life from a gnome stone excavator.
Your beating MASSACRES a gnome stone excavator!
Your beating maims a gnome stone excavator!
A netherium great staff draws life from a gnome stone excavator.
A gnome stone excavator is in awful condition.



None of those worked either!
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri May 09, 2008 1:50 pm   
 
Question:

Code:

#regex Damage_Convert {^(?>\[[^\]]*\] )?(?:Your|A|The|a|the|An)? (?:[\w']+(?: [\w']+(?: [\w']+)?)?)? (@attack_type)(?: does)? ($Dam_Val:@damage_type)(?: things to)?(?: a|the|A|The)? (\w+( \w+( \w+)?)?)[!\.]$}   


is equal to:

Code:

#regex Damage_Convert {^(?>\[[^\]]*\] )?(?:Your|A|The|a|the|An)? (?:[\w']+(?: [\w']+(?: [\w']+)?)?)? (@attack_type)(?: does)? (@damage_type)(?: things to)?(?: a|the|A|The)? (\w+( \w+( \w+)?)?)[!\.]$}   
{
  $Dmg_Val=%2


?
_________________
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: Fri May 09, 2008 2:04 pm   
 
I think so. Your pattern is a bit spaghettified, so it's hard to tell, but if you mean:

#trig {(*)} {$something=%1}
equals
#trig {($something:*)} {}

Then you'd be correct, though the latter is allegedly faster.
_________________
Rorso's syntax colouriser.

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


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri May 09, 2008 2:11 pm   
 
Right, and mine is the first way. I'd like to do it the latter way it would be faster and such.

edit:

Got an invalid local variable error Sad
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Fri May 09, 2008 2:53 pm   
 
Using the exact regex you have above? Is the error in the pattern or the script? If the pattern, have you tried removing the underscore? If the script, make sure that all instances of the name in the script (the line numbers given with the error should be accurate to point you to the problem ones) are exactly the same as that in the pattern.
_________________
Rorso's syntax colouriser.

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


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Fri May 09, 2008 4:25 pm   
 
Do you have case sensitive selected on your trigger?

Why do you have stuff like this:

Code:
(?:Your|A|The|a|the|An)?


If it isn't case sensitive all you need is this:

Code:
(?>Your|an?|the)?
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri May 09, 2008 5:07 pm   
 
oldguy2 wrote:
Do you have case sensitive selected on your trigger?

Why do you have stuff like this:

Code:
(?:Your|A|The|a|the|An)?


If it isn't case sensitive all you need is this:

Code:
(?>Your|an?|the)?


It is not. It's just habit to assume case sensitivity. I will put up a few things in response shortly.

Current Trigger Script:
Code:

#wait 400
#say Loading Damage Convertor and Display Trigger...
#regex Damage_Convert {^(?>\[[^\]]*\] )?(?:Your|a|the|an)? (?:[\w']+(?: [\w']+(?: [\w']+)?)?)? ($DamVal:@damage_type)(?: does)? (@damage_type)(?: things to)?(?: a|the|A|The)? (\w+( \w+( \w+)?)?)[!\.]$}   
{
  $Dmg=" "
  #switch ($DmgVal)
    ("misses") {$Dmg=0}
    ("scratches") {$Dmg=2.5}
    ("grazes") {$Dmg=6.5}
    ("hits") {$Dmg=10.5}
    ("injures") {$Dmg=14.5}
    ("wounds") {$Dmg=18.5}
    ("mauls") {$Dmg=22.5}
    ("decimates") {$Dmg=26.5}
    ("devastates") {$Dmg=30.5}
    ("maims") {$Dmg=34.5}
    ("MUTILATES") {$Dmg=38.5}
    ("DISEMBOWELS") {$Dmg=42.5}
    ("DISMEMBERS") {$Dmg=46.5}
    ("MASSACRES") {$Dmg=50.5}
    ("MANGLES") {$Dmg=54.5}
    ("*** DEMOLISHES ***") {$Dmg=58.5}
    ("*** DEVASTATES ***") {$Dmg=68}
    ("=== OBLITERATES ===") {$Dmg=88}
    (">>> ANNIHILATES <<<") {$Dmg= 112}
    ("<<< ERADICATES >>>") {$Dmg=136}
    ("GHASTLY") {$Dmg=163}
    ("HORRID") {$Dmg=188}
    ("DREADFUL") {$Dmg=228}
    ("HIDEOUS") {$Dmg=238}
    ("INDESCRIBABLE") {$Dmg=263}
    ("UNSPEAKABLE") {$Dmg=280}

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

} {General Triggers|Damage Calculator}


Screenshot of Error:


Last edited by chamenas on Fri May 09, 2008 5:19 pm; edited 1 time in total
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Fri May 09, 2008 5:15 pm   
 
Okay I copied what you had over. First of all, you have a couple totally different patterns above that will not work with this trigger because they don't have attacks or damages.

Patterns:

A gnome stone excavator is in awful condition.
A gnome stone excavator dodges your attack.


The other pattern you don't have draws as an attack an life as damage type so it will never fire either:

A netherium great staff draws life from a gnome stone excavator.

Second of all you changed the expressions to make no sense at all so it won't fire on certain lines.

This:

Code:
($Dmg <= 34.5) AND ($Dmg <=0))


Will not work. It will always have to be less than or equal to 0 for that to work. You made the first match equal to 0. So this one should be as follows:

Code:
(($dmg > 0) AND ($dm <= 34.5))


So considering that with the right trigger pattern you get:

A gnome stone excavator's slash mauls you.(22.5) dmg
Your beating DISMEMBERS a gnome stone excavator! (46.5) dmg
Your beating maims a gnome stone excavator!(34.5) dmg
A netherium great staff draws life from a gnome stone excavator.
Your beating MANGLES a gnome stone excavator! (54.5) dmg
A gnome stone excavator dodges your attack.
A netherium great staff draws life from a gnome stone excavator.
Your beating MASSACRES a gnome stone excavator! (50.5) dmg
Your beating maims a gnome stone excavator!(34.5) dmg
A netherium great staff draws life from a gnome stone excavator.
A gnome stone excavator is in awful condition.


In the trigger pattern you really don't even need to include the "your|the|a|an|A|An|The" so just try this it will work fine.

Code:
^(?>\[[^\]]*\] )?(?>\w+'?\s?)+?(@attack_type) (?>does )?(@damage_type) (?>things to )?(?>a |the )?(?>\w+\s?)+?[!.]
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri May 09, 2008 5:18 pm   
 
It was a straight copy and paste, non-damage lines are obviously not targeted. Sorry for the confusion on that.

Can you explain how you account for the possibility of more than word in the name at the beginning? the syntax (?>\w+'?\s?)+ is interesting to me
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Fri May 09, 2008 5:41 pm   
 
You should have $Dmg_val=%2 as the first line. But I see you put it in the trigger itself... Of course if you look at your trigger you put it in the attack type so you have two backreferences for damage type now.


As to this:

Code:
(?>\w+'?\s?)+?


It will match a word followed by an optional apostrophe followed by an optional space at least once or more than once. Plus it won't backtrack all to hell and flip out. If you take the pattern you have to do a step test you will see what I mean. You might try downloading Regex Coach. It's free. Although it isn't as great as RegexBuddy it is just as good. In fact RegexBuddy and Regex Coach are probably the two best RegEx testers/Debuggers I have found.

The other thing you have to watch out for is how you do your spacing. That trigger you posted won't even work just because of how you have it spaced.

See this part:

Code:
(?:[\w']+(?: [\w']+(?: [\w']+)?)?)


This won't work unless you include a space at the beginning like you did the others.

Code:
(?: [\w']+(?: [\w']+(?: [\w']+)?)?)


Then it should be connected to the other part of the pattern:

Code:
(?:Your|a|the|an)?(?: [\w']+(?: [\w']+(?: [\w']+)?)?)


By the way, you said:

Quote:
It's just habit to assume case sensitivity.


Okay if it actually WAS case sensitive, you just need this.

Code:
(?>Your|[Aa]n?|[Tt]he)?


Either way you don't need that part with the trigger I posted.


Last edited by oldguy2 on Fri May 09, 2008 5:54 pm; edited 1 time in total
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Fri May 09, 2008 5:45 pm   
 
You're trying to use DmgVal, but your pattern defines DamVal?
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri May 09, 2008 5:52 pm   
 
Larkin wrote:
You're trying to use DmgVal, but your pattern defines DamVal?


Doh! You're right. Geez. Embarassed

@Oldguy - Thanks, I think I get you but I'll reread it later. I'm still trying to figure out why I would need a regex tester? Can I test it just fine in CMUD?

Edit:

Well, I fixed DmgVal, still have the same error Crying or Very sad
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Fri May 09, 2008 5:58 pm   
 
Well download it and you will see what I mean. I guess it would really help you in creating your patterns. It will instantly highlight the text if it matches, show you the tree, and let you step through it. Regex Coach you have to press a step button but RegexBuddy will instantly show you and tell you how many steps it takes to match. Some patterns you might think "well hey it matches so what the hell" might take 500 steps to match a single line! lol
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri May 09, 2008 5:59 pm   
 
By the way...

Your flaming bite misses a creature! (0) dmg
Your flaming bite misses a creature. (0) dmg
Your flaming bite grazes a creature!
Your flaming bite grazes a creature.
Your flaming bite DISEMBOWELS a creature! (42.5) dmg
Your flaming bite DISEMBOWELS a creature. (42.5) dmg
Your flaming bite *** DEVASTATES *** a creature! (68) dmg
Your flaming bite *** DEVASTATES *** a creature. (68) dmg
Your flaming bite does UNSPEAKABLE things to a creature! (280) dmg
Your flaming bite does UNSPEAKABLE things to a creature. (280) dmg
----------------------------------------------------------
Your crush misses a creature! (0) dmg
Your crush misses a creature. (0) dmg
Your crush grazes a creature!
Your crush grazes a creature.
Your crush DISEMBOWELS a creature! (42.5) dmg
Your crush DISEMBOWELS a creature. (42.5) dmg
Your crush *** DEVASTATES *** a creature! (68) dmg
Your crush *** DEVASTATES *** a creature. (68) dmg
Your crush does UNSPEAKABLE things to a creature! (280) dmg
Your crush does UNSPEAKABLE things to a creature. (280) dmg
-----------------------------------------------------------
A green forest treant's flaming bite misses a creature! (0) dmg
A green forest treant's flaming bite misses a creature. (0) dmg
A green forest treant's flaming bite grazes a creature!
A green forest treant's flaming bite grazes a creature.
A green forest treant's flaming bite DISEMBOWELS a creature! (42.5) dmg
A green forest treant's flaming bite DISEMBOWELS a creature. (42.5) dmg
A green forest treant's flaming bite *** DEVASTATES *** a creature! (68) dmg
A green forest treant's flaming bite *** DEVASTATES *** a creature. (68) dmg
A green forest treant's flaming bite does UNSPEAKABLE things to a creature! (280) dmg
A green forest treant's flaming bite does UNSPEAKABLE things to a creature. (280) dmg
----------------------------------------------------------
A green forest treant's crush misses a creature! (0) dmg
A green forest treant's crush misses a creature. (0) dmg
A green forest treant's crush grazes a creature!
A green forest treant's crush grazes a creature.
A green forest treant's crush DISEMBOWELS a creature! (42.5) dmg
A green forest treant's crush DISEMBOWELS a creature. (42.5) dmg
A green forest treant's crush *** DEVASTATES *** a creature! (68) dmg
A green forest treant's crush *** DEVASTATES *** a creature. (68) dmg
A green forest treant's crush does UNSPEAKABLE things to a creature! (280) dmg
A green forest treant's crush does UNSPEAKABLE things to a creature. (280) dmg
A forest treant's flaming bite misses a creature! (0) dmg
A forest treant's flaming bite misses a creature. (0) dmg
A forest treant's flaming bite grazes a creature!
A forest treant's flaming bite grazes a creature.
A forest treant's flaming bite DISEMBOWELS a creature! (42.5) dmg
A forest treant's flaming bite DISEMBOWELS a creature. (42.5) dmg
A forest treant's flaming bite *** DEVASTATES *** a creature! (68) dmg
A forest treant's flaming bite *** DEVASTATES *** a creature. (68) dmg
A forest treant's flaming bite does UNSPEAKABLE things to a creature! (280) dmg
A forest treant's flaming bite does UNSPEAKABLE things to a creature. (280) dmg
----------------------------------------------------------
A forest treant's crush misses a creature! (0) dmg
A forest treant's crush misses a creature. (0) dmg
A forest treant's crush grazes a creature!
A forest treant's crush grazes a creature.
A forest treant's crush DISEMBOWELS a creature! (42.5) dmg
A forest treant's crush DISEMBOWELS a creature. (42.5) dmg
A forest treant's crush *** DEVASTATES *** a creature! (68) dmg
A forest treant's crush *** DEVASTATES *** a creature. (68) dmg
A forest treant's crush does UNSPEAKABLE things to a creature! (280) dmg
A forest treant's crush does UNSPEAKABLE things to a creature. (280) dmg
-----------------------------------------------------------
A treant's flaming bite misses a creature! (0) dmg
A treant's flaming bite misses a creature. (0) dmg
A treant's flaming bite grazes a creature!
A treant's flaming bite grazes a creature.
A treant's flaming bite DISEMBOWELS a creature! (42.5) dmg
A treant's flaming bite DISEMBOWELS a creature. (42.5) dmg
A treant's flaming bite *** DEVASTATES *** a creature! (68) dmg
A treant's flaming bite *** DEVASTATES *** a creature. (68) dmg
A treant's flaming bite does UNSPEAKABLE things to a creature! (280) dmg
A treant's flaming bite does UNSPEAKABLE things to a creature. (280) dmg
----------------------------------------------------------
A treant's crush misses a creature! (0) dmg
A treant's crush misses a creature. (0) dmg
A treant's crush grazes a creature!
A treant's crush grazes a creature.
A treant's crush DISEMBOWELS a creature! (42.5) dmg
A treant's crush DISEMBOWELS a creature. (42.5) dmg
A treant's crush *** DEVASTATES *** a creature! (68) dmg
A treant's crush *** DEVASTATES *** a creature. (68) dmg
A treant's crush does UNSPEAKABLE things to a creature! (280) dmg
A treant's crush does UNSPEAKABLE things to a creature. (280) dmg
-----------------------------------------------------------
Irtia's flaming bite misses a creature! (0) dmg
Irtia's flaming bite misses a creature. (0) dmg
Irtia's flaming bite grazes a creature!
Irtia's flaming bite grazes a creature.
Irtia's flaming bite DISEMBOWELS a creature! (42.5) dmg
Irtia's flaming bite DISEMBOWELS a creature. (42.5) dmg
Irtia's flaming bite *** DEVASTATES *** a creature! (68) dmg
Irtia's flaming bite *** DEVASTATES *** a creature. (68) dmg
Irtia's flaming bite does UNSPEAKABLE things to a creature! (280) dmg
Irtia's flaming bite does UNSPEAKABLE things to a creature. (280) dmg
----------------------------------------------------------
Irtia's crush misses a creature! (0) dmg
Irtia's crush misses a creature. (0) dmg
Irtia's crush grazes a creature!
Irtia's crush grazes a creature.
Irtia's crush DISEMBOWELS a creature! (42.5) dmg
Irtia's crush DISEMBOWELS a creature. (42.5) dmg
Irtia's crush *** DEVASTATES *** a creature! (68) dmg
Irtia's crush *** DEVASTATES *** a creature. (68) dmg
Irtia's crush does UNSPEAKABLE things to a creature! (280) dmg
Irtia's crush does UNSPEAKABLE things to a creature. (280) dmg
-----------------------------------------------------------


It worked for the most part. grazes is still not firing, oddly.

Code:
#var damage_type {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} _nodef {General Variables|Damage Calculator}


IS that stringlist variable
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri May 09, 2008 6:01 pm   
 
By the way, which editor do you prefer, Oldguy?
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri May 09, 2008 6:10 pm   
 
Damn... it passed my test, but not real usage. Once again, omit non-damage lines...


A sea-worn fisherman's punch misses you.
Vianica's flaming bite MANGLES a sea-worn fisherman!
A flaming dagger draws life from a sea-worn fisherman.
Vianica's flaming bite MASSACRES a sea-worn fisherman!
A flaming dagger draws life from a sea-worn fisherman.
Vianica's flaming bite MANGLES a sea-worn fisherman!
A flaming dagger draws life from a sea-worn fisherman.
Your beating MANGLES a sea-worn fisherman!
Your beating MUTILATES a sea-worn fisherman!
A netherium great staff draws life from a sea-worn fisherman.
Your beating MANGLES a sea-worn fisherman!
Your beating MUTILATES a sea-worn fisherman!
A netherium great staff draws life from a sea-worn fisherman.
A sea-worn fisherman looks pretty hurt.

Edit:
Must be the hyphen, seems to work fine otherwise.
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Fri May 09, 2008 6:49 pm   
 
It is. Just change the ending and add one.

Code:
(?>\w+\-?\s?)+?
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri May 09, 2008 7:05 pm   
 
oldguy2 wrote:
It is. Just change the ending and add one.

Code:
(?>\w+\-?\s?)+?


I figured that would be the solution.

Still want your opinion :P

actually, why isn't it...

[w\-]+ ?
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri May 09, 2008 7:08 pm   
 
Same thing for the beginning? I need it there too
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Fri May 09, 2008 8:52 pm   
 
So just add it in the first one as well.


By "[w\-]+ ?" I assume you mean "[\w\- ]+?" instead?

The +? means you are making the + lazy.

The thing with that is it would match stuff like this:

Your - attack...

Here try this out. I swear it will save you a lot of headache. You can try RegexBuddy but after the trial you have to pay for it. This one is free.

http://www.snapfiles.com/get/regexcoach.html
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri May 09, 2008 9:13 pm   
 
hrmm, alright. Thanks.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri May 09, 2008 11:13 pm   
 
The problem with regex coach is that I'm going to have to manually paste the variables in Confused, but that's not too much to ask for.

Still... I did what I was told would work:
Code:

^(?>\[[^\]]*\] )?(?>\w+\-?'?\s?)+?(@attack_type) (?>does )?(@damage_type) (?>things to )?(?>a |the )?(?>\w+\-?\s?)+?[!.]


A sea-worn fisherman's punch misses you. (0) dmg

yay


A sea-worn fisherman's punch wounds you.


errr...

so I dont know why, for no reason, it decides to match for one but not the other. I'm certain punch is one of my attack types.
_________________
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
Goto page 1, 2  Next
Page 1 of 2

 
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