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 Previous  1, 2, 3, 4, 5, 6  Next
chamenas Posted: Thu Apr 17, 2008 11:47 am
replacing lines of text before they show...
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sat Apr 19, 2008 7:04 pm   
 
This one has no errors:

Code:

#wait 400
#say Loading Damage Converter Trigger...
#regex Damage_Convert {^Your (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) (misses|maims|scratches|grazes|hits|injures|wounds|mauls|decimates|devestates|maims|MUTILATES|DISEMBOWELS|DISMEMBERS|MASSACRES|MANGLES|*** DEMOLISHES ***|*** DEVESTATES ***|=== OBLITERATES ===|>>> ANNIHILATES <<<|<<< ERADICATES >>>|GHASTLY|HORRID|DREADFUL|HIDEOUS|INDESSCRIBABLE|UNSPEAKABLE) (?:a|the| ) (.+)[!\.]$}
{ Dmg_Val=%2

 #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}
   ("INDESSCRIBABLE") {Dmg=263}
   ("UNSPEAKABLE") {Dmg=280}

 #sayadd {%ansi(gray)\(%ansi(red)@Dmg%ansi(gray)\) dmg %ansi(reset)}
} {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 19, 2008 7:38 pm   
 
Hmm... not working...


Your beating decimates the constellation of Austinian!
Your beating wounds the constellation of Austinian.
Your beating mauls the constellation of Austinian.
Your beating wounds the constellation of Austinian.


Nothing is being added.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sat Apr 19, 2008 9:58 pm   
 
Escape the stars like \*\*\*DEVASTATES\*\*\*
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Apr 20, 2008 4:04 am   
 
Quote:
(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)
It won't match any of those lines because beating is not in this list. Also the blank item between Magic and Peck makes no sense.
Quote:
(misses|maims|scratches|grazes|hits|injures|wounds|mauls|decimates|devestates|maims|MUTILATES|DISEMBOWELS|DISMEMBERS|MASSACRES|MANGLES|*** DEMOLISHES ***|*** DEVESTATES ***|=== OBLITERATES ===|>>> ANNIHILATES <<<|<<< ERADICATES >>>|GHASTLY|HORRID|DREADFUL|HIDEOUS|INDESSCRIBABLE|UNSPEAKABLE)
The asterisks need to be escaped, if you check the Test tab for the trigger you will find out that it does not compile with an error of 'Nothing to repeat'.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Apr 20, 2008 2:45 pm   
 
Vijilante wrote:
Quote:
(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)
It won't match any of those lines because beating is not in this list. Also the blank item between Magic and Peck makes no sense.
Quote:
(misses|maims|scratches|grazes|hits|injures|wounds|mauls|decimates|devestates|maims|MUTILATES|DISEMBOWELS|DISMEMBERS|MASSACRES|MANGLES|*** DEMOLISHES ***|*** DEVESTATES ***|=== OBLITERATES ===|>>> ANNIHILATES <<<|<<< ERADICATES >>>|GHASTLY|HORRID|DREADFUL|HIDEOUS|INDESSCRIBABLE|UNSPEAKABLE)
The asterisks need to be escaped, if you check the Test tab for the trigger you will find out that it does not compile with an error of 'Nothing to repeat'.


I fixed the asterisks but havent had a chance to test it yet. I'll take out the blank.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Apr 20, 2008 3:21 pm   
 
Finally got it to work as this:

Code:

#regex Damage_Convert {^Your (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) (misses|maims|scratches|grazes|hits|injures|wounds|mauls|decimates|devestates|maims|MUTILATES|DISEMBOWELS|DISMEMBERS|MASSACRES|MANGLES|\*\*\* DEMOLISHES \*\*\*|\*\*\* DEVESTATES \*\*\*|=== OBLITERATES ===|>>> ANNIHILATES <<<|<<< ERADICATES >>>|GHASTLY|HORRID|DREADFUL|HIDEOUS|INDESSCRIBABLE|UNSPEAKABLE) (?:a|the| ) (.+)[!\.]$}
{ Dmg_Val=%2

 #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}
   ("INDESSCRIBABLE") {Dmg=263}
   ("UNSPEAKABLE") {Dmg=280}

 #sayadd {%ansi(gray)(%ansi(high, red)@Dmg%ansi(gray)) dmg %ansi(reset)}
} {General Triggers|Damage Calculator}


So now it's time to move onto all of the other stuff I want to put in, you'll likely be seeing some posts when I stumble on problems.

Edit:
errr... this won't work

I imagine it has to do with how I set up #switch

Code:

 #switch (@Dmg)
   (@Dmg<34.5) {#sayadd {%ansi(gray)(%ansi(high, green)@Dmg%ansi(gray)) dmg %ansi(reset)}}
   (@Dmg<54.5 AND @Dmg>34.5) {#sayadd {%ansi(gray)(%ansi(high, yellow)@Dmg%ansi(gray)) dmg %ansi(reset)}}
   (@Dmg<280 AND @Dmg>54.4) {#sayadd {%ansi(gray)(%ansi(high, red)@Dmg%ansi(gray)) dmg %ansi(reset)}}

Edit2:

Sometimes I get


You dodge a small boy's attack.
Your beating MASSACRES a small boy!(50.5) dmg
Your beating MUTILATES a small boy!(38.5) dmg
Your beating MANGLES a small boy!(54.5) dmg
A small boy has quite a few wounds.

The first MASSACRES is yellow (the game makes it yellow) the following two are gray...
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Sun Apr 20, 2008 3:46 pm   
 
It's because you're using the alternate switch syntax. If you're going to use whole expressions like that, you shouldn't use the (@Dmg) part. Your first and second lines should be merged like this: #switch (@Dmg<34.5) {#sayadd {%ansi(gray)(%ansi(high, green)@Dmg%ansi(gray)) dmg %ansi(reset)}} and the other lines should stay the same.

Also, why are you using %ansi(gray) at the start when you're not making anything gray?
_________________
Rorso's syntax colouriser.

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


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Apr 20, 2008 4:16 pm   
 
Last time I used #switch on multiple lines, it didn't work. I used the alternate and it was fine, but the normal way doesn't want to work. The gray is coloring something (it's now changed to a variable the player can set), it's coloring a (

the ( is not escaped because when I did that, it showed up as \(78\)

so apparently it doesnt need to be escaped.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sun Apr 20, 2008 5:27 pm   
 
That's because it isn't regex. You escape it with "~" and not "\".

Also if your default session color is gray or silver there is really no need to change those colors like I showed you earlier. MXP is like 100 times better than ANSI and more colors.

Fang is right about how you are doing the switch statements. It should work fine.

It should look like this:

Code:

#switch (@Dmg <= 34.5) {#sayadd {~(<color lime>@Dmg</color>~) dmg}}
   ((@Dmg > 34.5) AND (@Dmg <= 54.5)) {#sayadd {~(<color yellow>@Dmg</color>~) dmg}}
   ((@Dmg > 54.5) AND (@Dmg < 280)) {#sayadd {~(<color red>@Dmg</color>~) dmg}}
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Apr 20, 2008 5:48 pm   
 
Your flaming bite *** DEMOLISHES *** A sasquatch!(0) dmg
Your flaming bite DISEMBOWELS A sasquatch!(42.5) dmg
A sasquatch is in awful condition.


I continue to get the gray bleeding over into my damage, and, if you look at the top line. My demolishes is somehow 0 dmg? I'm thinking it has something to do with the *s

Would help if I gave the script:

Code:

#regex Damage_Convert {^Your (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) (misses|maims|scratches|grazes|hits|injures|wounds|mauls|decimates|devestates|maims|MUTILATES|DISEMBOWELS|DISMEMBERS|MASSACRES|MANGLES|\*\*\* DEMOLISHES \*\*\*|\*\*\* DEVESTATES \*\*\*|=== OBLITERATES ===|>>> ANNIHILATES <<<|<<< ERADICATES >>>|GHASTLY|HORRID|DREADFUL|HIDEOUS|INDESSCRIBABLE|UNSPEAKABLE) (?:a|the| ) (.+)[!\.]$}
{ Dmg_Val=%2

 #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}
   ("INDESSCRIBABLE") {Dmg=263}
   ("UNSPEAKABLE") {Dmg=280}

   #sayadd {%ansi(high, @color)~(%ansi(high, red)@Dmg%ansi(high, @color)~) dmg %ansi(default)}

} {General Triggers|Damage Calculator}
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Sun Apr 20, 2008 5:57 pm   
 
Yes, it's because you have \ before the stars. It's not part of a regex, so there's no need to escape them. Furthermore, because it's not a regex and \ isn't a special character in CMUD, the \s are left in the string. Since "\*\*\*" isn't the same as "***", it never matches.
_________________
Rorso's syntax colouriser.

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


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sun Apr 20, 2008 6:01 pm   
 
Beat me to it.

Your code should look like this.

Code:

Dmg_Val=%2
#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}
  ("INDESSCRIBABLE") {Dmg=263}
  ("UNSPEAKABLE") {Dmg=280}
#switch (@Dmg <= 34.5) {#sayadd {~(<color lime>@Dmg</color>~) dmg}}
   ((@Dmg > 34.5) AND (@Dmg <= 54.5)) {#sayadd {~(<color yellow>@Dmg</color>~) dmg}}
   ((@Dmg > 54.5) AND (@Dmg < 280)) {#sayadd {~(<color red>@Dmg</color>~) dmg}}


Which will output the sayadd just fine.

Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Apr 20, 2008 6:19 pm   
 
Any reason you insist on using <color>

I keep using ansi, the original suggestion...
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Apr 20, 2008 6:27 pm   
 
Well then...

tried adding some stuff, and now it doesn't show. Embarassed

Code:


#var Pcolor_color1 " " _nodef {General Variables|Damage Calculator}

#var Pcolor_color2 " " _nodef {General Variables|Damage Calculator}

#var Pcolor_color3 " " _nodef {General Variables|Damage Calculator}

#var Pcolor_highlight1 " " _nodef {General Variables|Damage Calculator}

#var Pcolor_highlight2 " " _nodef {General Variables|Damage Calculator}

#var Pcolor_highlight3 " " _nodef {General Variables|Damage Calculator}

#oninput {^Pcolor Highlight1 (%w)} {#noinput;Pcolor_highlight=%1;#say Player Hightlight1 Set to: @Pcolor_highlight1} {General Aliases|Damage Calculator}

#oninput {^Pcolor Highlight2 (%w)} {#noinput;Pcolor_highlight=%1;#say Player Hightlight2 Set to: @Pcolor_highlight2} {General Aliases|Damage Calculator}

#oninput {^Pcolor Highlight3 (%w)} {#noinput;Pcolor_highlight=%1;#say Player Hightlight3 Set to: @Pcolor_highlight3} {General Aliases|Damage Calculator}

#oninput {^Pcolor Color1 (%w)} {#noinput;Pcolor_color=%1;#say Player Color 1 Set to: @Pcolor_color1} {General Aliases|Damage Calculator}

#oninput {^Pcolor Color2 (%w)} {#noinput;Pcolor_color=%1;#say Player Color 2 Set to: @Pcolor_color2} {General Aliases|Damage Calculator}

#oninput {^Pcolor Color3 (%w)} {#noinput;Pcolor_color=%1;#say Player Color 3 Set to: @Pcolor_color3} {General Aliases|Damage Calculator}

#regex Damage_Convert {^Your (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) (misses|maims|scratches|grazes|hits|injures|wounds|mauls|decimates|devestates|maims|MUTILATES|DISEMBOWELS|DISMEMBERS|MASSACRES|MANGLES|\*\*\* DEMOLISHES \*\*\*|\*\*\* DEVESTATES \*\*\*|=== OBLITERATES ===|>>> ANNIHILATES <<<|<<< ERADICATES >>>|GHASTLY|HORRID|DREADFUL|HIDEOUS|INDESSCRIBABLE|UNSPEAKABLE) (?:a|the| ) (.+)[!\.]$}
{ Dmg_Val=%2

#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}
  ("INDESSCRIBABLE") {Dmg=263}
  ("UNSPEAKABLE") {Dmg=280}

   #switch (@Dmg <= 34.5) {#sayadd {%ansi(@Pcolor_highlight1, @Pcolor_color1)~(%ansi(high, red)@Dmg%ansi(@Pcolor_highlight1, @Pcolor_color1)~) dmg %ansi(default)}}
      ((@Dmg > 34.5) AND (@Dmg <= 54.5)) {#sayadd {%ansi(@Pcolor_highlight2, @Pcolor_color2)~(%ansi(high, red)@Dmg%ansi(@Pcolor_highlight2, @Pcolor_color2)~) dmg %ansi(default)}}
      ((@Dmg > 54.5) AND (@Dmg < 280)) {#sayadd {%ansi(@Pcolor_highlight3, @Pcolor_color3)~(%ansi(high, red)@Dmg%ansi(@Pcolor_highlight3, @Pcolor_color3)~) dmg %ansi(default)}}

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


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sun Apr 20, 2008 6:31 pm   
 
Just because someone originally suggested it doesn't mean it's the best way to go. As I said, MXP, the "<color>" tags, are way better than ansi. First of all, ansi is severly limited. With MXP you have tons of colors to choose from. Hell if you want you can even change the font of your sayadd. Make it bold! Make it italics. Make it a big fat honking font. lol

Also I have a question for you. What you plan to do here is store the type of attack, type of damage, and target for each and every line and each and every target? Do you realize how HUGE your database would be?

Why not store the total damage for each damage type. You already know the target if indeed you are attacking it. Plus I would use local variables.

Something like this:

Code:

$dmgVal=%2
$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}
  ("INDESSCRIBABLE") {$dmg=263}
  ("UNSPEAKABLE") {$dmg=280}
#switch ($dmg <= 34.5) {#sayadd { ~(<color lime>$dmg</color>~) dmg}}
  (($dmg > 34.5) AND ($dmg <= 54.5)) {#sayadd { ~(<color yellow>$dmg</color>~) dmg}}
  (($dmg > 54.5) AND ($dmg < 280)) {#sayadd { ~(<color red>$dmg</color>~) dmg}}
#addkey dmgCount $dmgVal {%eval( %db( @dmgCount, $dmgVal) + $dmg)}


If you did #showdb @dmgCount, then you would see something like:

MASSACRES: 656.5
*** DEMOLISHES ***: 936
MUTILATES: 305
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Apr 20, 2008 6:48 pm   
 
When I mean damage type, I mean... shocking bite... etc...

and I don't plan on storing that permanently. The only thing I want to store permanently is the hp of all of the monsters I find (and there's a skill to figure out their hp on rangers and druids) and then have that run through so I can literally see how much hp they have left. However, at the moment, it's not even showing the damage from my end anymore, must be something to do with all of the variables I threw in the switch and ansi.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sun Apr 20, 2008 7:16 pm   
 
Has nothing to do with the variables and if you want to use ansi fine with me. I'm just saying MXP is much better. However, I have no frickin clue what the heck you are do with Pcolor and all that.

As far as storing stuff. Look first you said you want to store all that stuff permanently now you don't. You don't even NEED to backreference half the crap you have in the trigger pattern for what you want. All you need is what you are storing. Secondly, damage type would be the damage type not attack type. Your bite is your attack not the damage you do. If you bite DEVASTATES the target that is the damage done.

Third, if you want help I enjoy helping because half the time I need help figuring out stuff too. However, when I first offered to help you here you turned around and said no can't do that when you had no bleeping idea.

Soo here is ALL you need to do in your trigger. You need to backreference the DAMAGE TYPE and store it in a LOCAL variable called $dmgVal or whatever the hell you want to. Second, and if I understand you correctly, you want to display the health left on the monster instead of the actual damage you are doing or put both if you want. So in that case it is really simple. You need to capture that from somewhere, set it to global variable, but you only need to do this ONE time when you first target the creature.

Then in your script it would look like this:

Code:

$dmgVal=%2
$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}
  ("INDESSCRIBABLE") {$dmg=263}
  ("UNSPEAKABLE") {$dmg=280}
monsterHealth = @monsterHealth - $dmg
#switch ($dmg <= 34.5) {#sayadd { ~(<color lime>$dmg</color>~) dmg <color red>@monsterHealth</color> Remaining}}
  (($dmg > 34.5) AND ($dmg <= 54.5)) {#sayadd { ~(<color yellow>$dmg</color>~) dmg <color red>@monsterHealth</color> Remaining}}
  (($dmg > 54.5) AND ($dmg < 280)) {#sayadd { ~(<color red>$dmg</color>~) dmg <color red>@monsterHealth</color> Remaining}}


The output would look like this:

Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg 2367.5 Remaining
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg 2309 Remaining
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg 2250.5 Remaining
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg 2192 Remaining
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg 2133.5 Remaining
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg 2075 Remaining
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg 2016.5 Remaining
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg 1958 Remaining
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg 1899.5 Remaining
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg 1841 Remaining
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg 1782.5 Remaining
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg 1724 Remaining
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg 1665.5 Remaining
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg 1607 Remaining
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg 1548.5 Remaining


If that is not what you are saying, then you seriously confuse me dude. By the way, you said, "The only thing I want to store permanently is the hp of all of the monsters I find (and there's a skill to figure out their hp on rangers and druids) and then have that run through so I can literally see how much hp they have left." Easiest way to do that is use a database. The when you target something set monsterHealth to whatever the current monster is by getting the value from the database.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Apr 20, 2008 7:58 pm   
 
Yeah, sorry. I'm multi tasking and haven't really told you everything I mean.

The basic intent of this trigger is to do what we've made it do (though it doesn't work right now, for some reason) which is append the individual damage amounts to the line, because, numbers are far more useful to me than words, however pretty the words might be. However, I would like to do a lot more than that. In the end, I would like to be able to pull up a damage report after a fight with a monster (or another player, which is where the real usefulness comes in) to the effect of something like:

================================ Damage Report ================================
You | Total Damage: X to <Creature> with <Attack Type> | Total Hits: X for an Average Damage of: X
(Optional) <Pet> | Total Damage: X to <Creature> with <Attack Type> | Total Hits: X for an Average Damage of: X
<Creature>| Total Damage: X to You with <Attack Type> | Total Hits: X for an Average Damage of: X
Total Damage done to <Creature> | X | Total Damage done to You | X | Total Damage done to <Pet> | X |
===========================================================================

If it could be dynamic and expand for each individual in the fight, including other players on your side, etc... that would be neat. I would ask for one, but I like to try and make it myself and ask questions, it's far more valuable that way (I ask a lot of questions, however).

I can leave out the back references of the other things, for now, but they will be important later. As I said, all I want right now is the text with the damage. It does not need the other creature's hp because I haven't yet set up a database, but I'm hoping to add that in eventually.

Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg
Your flaming bite *** DEMOLISHES *** A sasquatch! (58.5) dmg
Sasquatch: 1548.5hp Remaining
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Apr 20, 2008 8:00 pm   
 
Here's what I have so far:

Pcolor has 3 variables so that the user can select all 3 colors that it can be shown in (since there's 3 colors for the 3 damage amount group types), it's Pcolor for "Player color" because I want something similar to go with Enemies too (Ecolor).

Code:

#var Dmg_Val " " _nodef {General Variables|Damage Calculator}

#var Dmg " " 0 {General Variables|Damage Calculator}

#var EDmg_Val " " _nodef {General Variables|Damage Calculator}

#var EDmg " " 0 {General Variables|Damage Calculator}

#var Pcolor_color1 " " _nodef {General Variables|Damage Calculator}

#var Pcolor_color2 " " _nodef {General Variables|Damage Calculator}

#var Pcolor_color3 " " _nodef {General Variables|Damage Calculator}

#oninput {^Pcolor Color1 (*)} {#noinput;Pcolor_color=%1;#say Player Color 1 Set to: @Pcolor_color1} {General Aliases|Damage Calculator}

#oninput {^Pcolor Color2 (*)} {#noinput;Pcolor_color=%1;#say Player Color 2 Set to: @Pcolor_color2} {General Aliases|Damage Calculator}

#oninput {^Pcolor Color3 (*)} {#noinput;Pcolor_color=%1;#say Player Color 3 Set to: @Pcolor_color3} {General Aliases|Damage Calculator}

#regex Damage_Convert {^Your (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) (misses|maims|scratches|grazes|hits|injures|wounds|mauls|decimates|devestates|maims|MUTILATES|DISEMBOWELS|DISMEMBERS|MASSACRES|MANGLES|\*\*\* DEMOLISHES \*\*\*|\*\*\* DEVESTATES \*\*\*|=== OBLITERATES ===|>>> ANNIHILATES <<<|<<< ERADICATES >>>|GHASTLY|HORRID|DREADFUL|HIDEOUS|INDESSCRIBABLE|UNSPEAKABLE) (?:a|the| ) (.+)[!\.]$}
{ Dmg_Val=%2

#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}
  ("INDESSCRIBABLE") {Dmg=263}
  ("UNSPEAKABLE") {Dmg=280}

   #switch (@Dmg <= 34.5) {#sayadd {<color @Pcolor_color1>)</color>~(<color red>)@Dmg</color><color @Pcolor_color1>)~) dmg </color>}}
      ((@Dmg > 34.5) AND (@Dmg <= 54.5)) {#sayadd {<color @Pcolor_color2>)</color>~(<color red>)@Dmg</color><color @Pcolor_color2>)~) dmg </color>}}
      ((@Dmg > 54.5) AND (@Dmg < 280)) {#sayadd {<color @Pcolor_color3>)</color>~(<color red>)@Dmg</color><color @Pcolor_color3>)~) dmg </color>}}

} {General Triggers|Damage Calculator}

#regex Damage_Convert {(?:A|The)? .* (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) (misses|maims|scratches|grazes|hits|injures|wounds|mauls|decimates|devestates|maims|MUTILATES|DISEMBOWELS|DISMEMBERS|MASSACRES|MANGLES|\*\*\* DEMOLISHES \*\*\*|\*\*\* DEVESTATES \*\*\*|=== OBLITERATES ===|>>> ANNIHILATES <<<|<<< ERADICATES >>>|GHASTLY|HORRID|DREADFUL|HIDEOUS|INDESSCRIBABLE|UNSPEAKABLE) you[!\.]$}
{ EDmg_Val=%2

#switch (@EDmg_Val)
  ("misses") {EDmg=0}
  ("scratches") {EDmg=2.5}
  ("grazes") {EDmg=6.5}
  ("hits") {EDmg=10.5}
  ("injures") {EDmg=14.5}
  ("wounds") {EDmg=18.5}
  ("mauls") {EDmg=22.5}
  ("decimates") {EDmg=26.5}
  ("devastates") {EDmg=30.5}
  ("maims") {EDmg=34.5}
  ("MUTILATES") {EDmg=38.5}
  ("DISEMBOWELS") {EDmg=42.5}
  ("DISMEMBERS") {EDmg=46.5}
  ("MASSACRES") {EDmg=50.5}
  ("MANGLES") {EDmg=54.5}
  ("*** DEMOLISHES ***") {EDmg=58.5}
  ("*** DEVASTATES ***") {EDmg=68}
  ("=== OBLITERATES ===") {EDmg=88}
  (">>> ANNIHILATES <<<") {EDmg= 112}
  ("<<< ERADICATES >>>") {EDmg=136}
  ("GHASTLY") {EDmg=163}
  ("HORRID") {EDmg=188}
  ("DREADFUL") {EDmg=228}
  ("HIDEOUS") {EDmg=238}
  ("INDESSCRIBABLE") {EDmg=263}
  ("UNSPEAKABLE") {EDmg=280}

   #sayadd {<color red>~(@EDmg~) Dmg to you!!!</color>}

} {General Triggers|Damage Calculator}

_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sun Apr 20, 2008 8:54 pm   
 
lol...ok. Man you are confusing guy. You just said the only thing you want to store permanently was the HP of the creature. Now you are saying you want to store the total damage done, which is what I thought in the first place. Although you are going to have to store a huge amount of data for all that and to get averages. However, I still don't see why you don't use local variables in your script. It's all about scope. You don't need to store the Dmg and Edmg permanently. Like I showed above there you would just add that amount or adjust a global variable afterward.

Like this maybe?

Code:

totalDmg = @totalDmg + $dmg
hits = @hits + 1
#addkey dmgType $dmgVal {%eval( %db( @dmgType, $dmgVal) + $dmg)}


I don't understand your variable names either. Ever heard of camel casing? Like you have Pcolor_color3. Why not just do pColor3 or whatever or your way Pcolor3. I guess you have your own way of doing stuff which is cool. Except if you code that way in real life and other people have to read your code they won't like you much. Also you are getting close to the name of a command in CMUD, #PCOL, which is what I thought you were trying to do earlier.

Good luck, and I hope it works out for you.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Apr 20, 2008 9:23 pm   
 
Yeah, that's where I want to get. I can change the variables to local, I just don't get why they aren't even working anymore.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sun Apr 20, 2008 9:47 pm   
 
Well it works fine when I put it in an empty session. What did you change? Backtrack the stuff you changed and see if you missed a bracket or something. Although I am not entirely sure what "doesn't work" means. Are you getting an error or what?
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Apr 20, 2008 10:42 pm   
 
It plain won't show the text beside the line anymore. I'll try doing some debugging, but it's something I'm miserable at.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sun Apr 20, 2008 10:56 pm   
 
Post the sayadd part of your script. Maybe you are just overlooking something.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Apr 20, 2008 10:59 pm   
 
How do I reference a local variable? I'm getting a syntax error because it doesn't recognize it $Dmg

and I'm not sure how it's picking up anything because it's not declared...

Code:

#regex Damage_Convert {^Your (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) (misses|maims|scratches|grazes|hits|injures|wounds|mauls|decimates|devestates|maims|MUTILATES|DISEMBOWELS|DISMEMBERS|MASSACRES|MANGLES|\*\*\* DEMOLISHES \*\*\*|\*\*\* DEVESTATES \*\*\*|=== OBLITERATES ===|>>> ANNIHILATES <<<|<<< ERADICATES >>>|GHASTLY|HORRID|DREADFUL|HIDEOUS|INDESSCRIBABLE|UNSPEAKABLE) (?:a|the|A|The)? (.+)[!\.]$}
{ 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}
  ("INDESSCRIBABLE") {Dmg=263}
  ("UNSPEAKABLE") {Dmg=280}

   #switch (@Dmg <= 34.5) {#sayadd {<color @Pcolor_color1>)</color>~(<color red>)$Dmg</color><color @Pcolor_color1>)~) dmg </color>}}
      ((@Dmg > 34.5) AND (@Dmg <= 54.5)) {#sayadd {<color @Pcolor_color2>)</color>~(<color red>)$Dmg</color><color @Pcolor_color2>)~) dmg </color>}}
      ((@Dmg > 54.5) AND (@Dmg < 280)) {#sayadd {<color @Pcolor_color3>)</color>~(<color red>)$Dmg</color><color @Pcolor_color3>)~) dmg </color>}}

} {General Triggers|Damage Calculator}


Alright, looking at the error message:

"Invalid local variable"

So it seas the variable, but apparently I'm not referencing it right?
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6  Next
Page 3 of 6

 
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