Zmud Damage Counter

From AvatarWiki
Revision as of 16:34, 1 September 2007 by Everman (talk | contribs) (First revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This trigger and alias set will track damage dealt and received for all on a member list. For each line of combat the hit is stored by damage verb if the person attacking was on the list, and a running damage total is kept. Damage values were taken from Damage, missing values were extrapolated. Valid damage ranges from weak to ***ANNIH. Report options include a display of {damage done/ average hit/ damage taken} or a breakdown of all hits by verb. You may display these for yourself, everyone or a partial selection. Efforts have been made to make sure that all damage is counted, currently I am under the impression that melee damage as well as spell damage that includes your name and throwing damage is accounted for. The damage done by shield charges is not.

If you have made any helpful upgrades to this code I'd appreciate it if you'd share and post it in the discussion area, though I'm presenting this as is and don't intend to consistently maintain it :)

Code

Copy each line individually and then paste them into zMud [1]:

#CLASS {Damagecounter}
#ALIAS dcadd {#additem DClist %1;#var %1 0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0;#echo %1 added to the damage counting list.}
#ALIAS dcrep {#YESNO "What report would you like to show?" {Short report (total damage done and taken) :dcrep1} {Breakdown of damage verbs:dcrep2}}
#ALIAS dcclear {#FO @DClist {#UNVAR %i};#VAR DClist "";#VAR DCterm 0;dcadd your;#ECHO Damagecounter reset. Please re-add groupies.}
#ALIAS dcrep2 {#if (!@DCreport) {dcrepto};#YESNO "Who would you like to report for?" {Yourself:#VAR DCreportfor "your"} {Everyone:#VAR DCreportfor @DClist} {Partial:#VAR DCreportfor %pick( p:Who would you like to display reports for?:, @DClist)};#FO @DCreportfor {@DCreport Breakdown for %if( %i="your", Myself, %upper( %left( %i, 1))%right( %i, 1)):%if( %item( @{%i}, 1), %char( 32)Tickling~(~|c~|%item( @{%i}, 1)~|n~|~))%if( %item( @{%i}, 2), %char( 32)Mauling~(~|c~|%item( @{%i}, 2)~|n~|~))%if( %item( @{%i}, 3), %char( 32)Decimating~(~|c~|%item( @{%i}, 3)~|n~|~))%if( %item( @{%i}, 4), %char( 32)Devasting~(~|c~|%item( @{%i}, 4)~|n~|~))%if( %item( @{%i}, 5), %char( 32)Pulverizing~(~|c~|%item( @{%i}, 5)~|n~|~))%if( %item( @{%i}, 6), %char( 32)Maiming~(~|c~|%item( @{%i}, 6)~|n~|~))%if( %item( @{%i}, 7), %char( 32)Eviscerating~(~|c~|%item( @{%i}, 7)~|n~|~))%if( %item( @{%i}, 8), %char( 32)Mutilating~(~|c~|%item( @{%i}, 8)~|n~|~))%if( %item( @{%i}, 9), %char( 32)Disemboweling~(~|c~|%item( @{%i}, 9)~|n~|~))%if( %item( @{%i}, 10), %char( 32)Dismembering~(~|c~|%item( @{%i}, 10)~|n~|~))%if( %item( @{%i}, 11), %char( 32)Massacring~(~|c~|%item( @{%i}, 11)~|n~|~))%if( %item( @{%i}, 12), %char( 32)Mangling~(~|c~|%item( @{%i}, 12)~|n~|~))%if( %item( @{%i}, 13), %char( 32)Demolishing~(~|c~|%item( @{%i}, 13)~|n~|~))%if( %item( @{%i}, 14), %char( 32)Obliterating~(~|c~|%item( @{%i}, 14)~|n~|~))%if( %item( @{%i}, 15), %char( 32)Annihilating~(~|c~|%item( @{%i}, 15)~|n~|~))%if( %item( @{%i}, 16), %char( 32)Terminal~(~|c~|%item( @{%i}, 16)~|n~|~))}}
#ALIAS dctermcheck {#FO @DClist {#VAR DCtemp1 0;#VAR DCtemp2 %i;#LOOP 2,15 {#VAR DCtemp1 %eval( @DCtemp1+%item( @{@DCtemp2}, %I))};#VAR DCtemp1 %eval( %item( @{@DCtemp2}, 17)/@DCtemp1);#VAR DCtemp1 %eval( @DCtemp1 * %item( @{@DCtemp2}, 16));#VAR DCtemp1 %eval( @DCtemp1 + %item( @{@DCtemp2}, 17));#VAR @DCtemp2 %replaceitem( @DCtemp1, 19, @{@DCtemp2})};#ECHO Terminal hits have been processed.}
#ALIAS dcrep1 {#if (!@DCreport) {dcrepto};#YESNO "Who would you like to report for?" {Yourself:#VAR DCreportfor "your"} {Everyone:#VAR DCreportfor @DClist} {Partial:#VAR DCreportfor %pick( p:Who would you like to display reports for?:, @DClist)};dctermcheck;dcavecheck;#VAR DCtemp1 0;#VAR DCtemp2 0;#VAR DCtemp3 0;#VAR DCtemp4 0;#FO @DClist {#IF {%eval( %item( @{%i}, 19) > @DCtemp1)} {#VAR DCtemp1 %item( @{%i}, 19)};#IF {%eval( %item( @{%i}, 18) > @DCtemp2)} {#VAR DCtemp2 %item( @{%i}, 18)};#ADD DCtemp3 %item( @{%i}, 19);#ADD DCtemp4 %item( @{%i}, 18)};#FO @DCreportfor {@DCreport ~|w~|Stats for %if( %i="your", Myself, %upper( %left( %i, 1))%right( %i, 1)): Dealt->%if( %item( @{%i}, 19) = @DCtemp1, ~|BC~|, ~|C~|)%item( @{%i}, 19)~|w~|~(%eval( %item( @{%i}, 19)*100/@DCtemp3)%~) Average~[~|bk~|%item( @damageverbs, %item( @{%i}, 20))~|w~|~] Taken->%if( %item( @{%i}, 18) = @DCtemp2, ~|BR~|, ~|R~|)%item( @{%i}, 18)~|w~|~(%eval( %item( @{%i}, 18)*100/@DCtemp4)%~)}}
#ALIAS dcavecheck {#FO @DClist {#var DCtemp1 %i;#var DCtemp2 0;#LOOP 1,15 {#VAR DCtemp2 %eval( @DCtemp2+%item( @{@DCtemp1}, %I))};#var DCtemp2 %eval( %item( @{%i}, 17)/@DCtemp2);#var DCtemp3 %item( @damagevalues, 75);#var DCtemp4 75;#WHILE (@DCtemp2 < @DCtemp3) {#add DCtemp4 -1;#var DCtemp3 %item( @damagevalues, @DCtemp4)};#VAR %i %replaceitem( @DCtemp4, 20, @{%i})}}
#ALIAS dcstart {dcclear;#if (!@DCreport) {@DCreport = gt} {};#if {%1} {@DCtemp1 = %1} {@DCtemp1 = 2;#prompt DCtemp1 "How many people are in the group?"};#if (@DCtemp < 10) {#loop @DCtemp1 {#temp {^ %i|??? ???? (&%wDCtemp1)} {#if (%lower( @DCtemp1) != @dcCurChar) {dcadd %lower( @DCtemp1)}}}} {#loop 1,9 {#temp {^ %i|??? ???? (&%wDCtemp1)} {#if (%lower( @DCtemp1) != @dcCurChar) {dcadd %lower( @DCtemp1)}}};#loop 10,@DCtemp {#temp {^%i|??? ???? (&%wDCtemp1)} {#if (%lower( @DCtemp1) != @dcCurChar) {dcadd %lower( @DCtemp1)}}}};group}
#ALIAS dcrepto {#prompt DCreport "Enter the channel to output to, eg gt, say ect."}
#VAR damageverbs {weak|punishing|surprising|amazing|astonishing|mauling|MAULING|MAULING*|MAULING**|MAULING***|decimating|DECIMATING|DECIMATING*|DECIMATING**|DECIMATING***|devastating|DEVASTATING|DEVASTATING*|DEVASTATING**|DEVASTATING***|pulverizing|PULVERIZING|PULVERIZING*|PULVERIZING**|PULVERIZING***|maiming|MAIMING|MAIMING*|MAIMING**|MAIMING***|eviscerating|EVISCERATING|EVISCERATING*|EVISCERATING**|EVISCERATING***|mutilating|MUTILATING|MUTILATING*|MUTILATING**|MUTILATING***|disemboweling|DISEMBOWELING|DISEMBOWELING*|DISEMBOWELING**|DISEMBOWELING***|dismembering|DISMEMBERING|DISMEMBERING*|DISMEMBERING**|DISMEMBERING***|massacring|MASSACRING|MASSACRING*|MASSACRING**|MASSACRING***|mangling|MANGLING|MANGLING*|MANGLING**|MANGLING***|demolishing|DEMOLISHING|DEMOLISHING*|DEMOLISHING**|DEMOLISHING***|obliterating|OBLITERATING|OBLITERATING*|OBLITERATING**|OBLITERATING***|annihilating|ANNIHILATING|ANNIHILATING*|ANNIHILATING**|ANNIHILATING***|terminal}
#VAR damagevalues {4|8|10|12|16|19|24|28|32|36|40|43|49|54|58|62|67|73|78|81|88|95|97|101|120|130|140|143|152|161|174|185|195|202|239|266|292|316|330|353|378|410|437|469|492|539|580|616|652|714|774|824|872|900|1000|1075|1150|1250|1350|1445|1516|1609|1750|1850|1945|2090|2340|2500|2700|2900|3000|3250|3500|3750|4000|0}
#VAR damageverbshort {mauling|decimating|devastating|pulverizing|maiming|eviscerating|mutilating|disemboweling|dismembering|massacring|mangling|demolishing|obliterating|annihilating|terminal}
#TRIGGER {^(%w)[^>;]{strike|strikes|hits|blast|blasts} (%w)[^>;]with([* ])(%w)[* ]%w[!.]} {#IF {%ismember( %lower( %1), @DClist)} {#VAR %lower( %1) %replaceitem( %eval( %item( @damagevalues, %ismember( %concat( %4, %3), @damageverbs))+%item( @{%lower( %1)}, 17)), 17, @{%lower( %1)});#VAR %lower( %1) %replaceitem( %eval( %item( @{%lower( %1)}, %eval( %ismember( %lower( %4), @damageverbshort)+1))+1) , %eval( %ismember( %lower( %4), @damageverbshort)+1) , @{%lower( %1)})};#IF {%ismember( %lower( %2), @DClist)} {#VAR %lower( %2) %replaceitem( %eval( %item( @damagevalues, %ismember( %concat( %4, %3), @damageverbs))+%item( @{%lower( %2)}, 18)), 18, @{%lower( %2)})};#IF {%lower( %2) = "you"} {#VAR %lower( your) %replaceitem( %eval( %item( @damagevalues, %ismember( %concat( %4, %3), @damageverbs))+%item( @{%lower( your)}, 18)), 18, @{%lower( your)})}}
#TRIGGER {^Welcome back to the AVATAR System, {lord|lady|hero} (%w).} {#var dcCurChar %lower( %1)}
#TRIGGER {^Welcome back to the AVATAR System (%w),} {#var dcCurChar %lower( %1)}
#MENU {DC Add} {dcadd %lower( %selword)} ""
#MENU {DC Clear} {dcclear} ""
#MENU {DC List} {#ec -;#ec --- CHARACTERS ON THE DC LIST ---;#fo @DClist {#ec %i}} ""
#CLASS 0

[1] Instead, you could just copy and paste it into a *.txt file. Then, in zMUD, go to "Settings -> File -> Import Text" and select the file you saved to.

Usage

Type dcstart [numberofgroupmembers] to initialize, for example if there are 3 people in the group type dcstart 3. This will create 3 temporary triggers that trigger on the group command, send the group command to the mud, and add the people in the group except yourself because you are always tracked. This command also clears all previous data.

If you need to add one member, or would rather add members by hand, you can either right click on their name and select DC Add, or you can type dcadd [name]. If You type dcadd [name] make sure to type the name in lowercase.

Two other commands have also been added to the right click menu. DC Clear, which will clear out the tracking variables and DC List which will tell you who you are tracking.

Whenever you want to display a report type dcrep and you will be presented with a few options that are self explanatory.

How It Works

This codes a bit convoluted so my apologies ahead of time.

#TRIGGER {^(%w)[^>;]{strike|strikes|hits|blast|blasts} (%w)[^>;]with([* ])(%w)[* ]%w[!.]} {#IF {%ismember( %lower( %1), @DClist)} {#VAR %lower( %1) %replaceitem( %eval( %item( @damagevalues, %ismember( %concat( %4, %3), @damageverbs))+%item( @{%lower( %1)}, 17)), 17, @{%lower( %1)});#VAR %lower( %1) %replaceitem( %eval( %item( @{%lower( %1)}, %eval( %ismember( %lower( %4), @damageverbshort)+1))+1) , %eval( %ismember( %lower( %4), @damageverbshort)+1) , @{%lower( %1)})};#IF {%ismember( %lower( %2), @DClist)} {#VAR %lower( %2) %replaceitem( %eval( %item( @damagevalues, %ismember( %concat( %4, %3), @damageverbs))+%item( @{%lower( %2)}, 18)), 18, @{%lower( %2)})};#IF {%lower( %2) = "you"} {#VAR %lower( your) %replaceitem( %eval( %item( @damagevalues, %ismember( %concat( %4, %3), @damageverbs))+%item( @{%lower( your)}, 18)), 18, @{%lower( your)})}}

This is where all of the damage tracking takes place. The trigger line should trigger for all damage done by someone to someone, including melee, magic and throwing. There are 3 if statements including within. The first of which checks to see if someone on the tracking list dealt the damage. If they did it updates the array adding the hit and the damage. The Second if statement checks to see if someone on the list was dealt damage. If they were it will add how much damage they took. Since damage dealt by you is shown as 'your' while damage dealt to you is shown to 'you' there is a third if statement that does the same as the second but just catches damage done to you.

#VAR damageverbs {weak|punishing|surprising|amazing|astonishing|mauling|MAULING|MAULING*|MAULING**|MAULING***|decimating|DECIMATING|DECIMATING*|DECIMATING**|DECIMATING***|devastating|DEVASTATING|DEVASTATING*|DEVASTATING**|DEVASTATING***|pulverizing|PULVERIZING|PULVERIZING*|PULVERIZING**|PULVERIZING***|maiming|MAIMING|MAIMING*|MAIMING**|MAIMING***|eviscerating|EVISCERATING|EVISCERATING*|EVISCERATING**|EVISCERATING***|mutilating|MUTILATING|MUTILATING*|MUTILATING**|MUTILATING***|disemboweling|DISEMBOWELING|DISEMBOWELING*|DISEMBOWELING**|DISEMBOWELING***|dismembering|DISMEMBERING|DISMEMBERING*|DISMEMBERING**|DISMEMBERING***|massacring|MASSACRING|MASSACRING*|MASSACRING**|MASSACRING***|mangling|MANGLING|MANGLING*|MANGLING**|MANGLING***|demolishing|DEMOLISHING|DEMOLISHING*|DEMOLISHING**|DEMOLISHING***|obliterating|OBLITERATING|OBLITERATING*|OBLITERATING**|OBLITERATING***|annihilating|ANNIHILATING|ANNIHILATING*|ANNIHILATING**|ANNIHILATING***|terminal}
#VAR damagevalues {4|8|10|12|16|19|24|28|32|36|40|43|49|54|58|62|67|73|78|81|88|95|97|101|120|130|140|143|152|161|174|185|195|202|239|266|292|316|330|353|378|410|437|469|492|539|580|616|652|714|774|824|872|900|1000|1075|1150|1250|1350|1445|1516|1609|1750|1850|1945|2090|2340|2500|2700|2900|3000|3250|3500|3750|4000|0}
#VAR damageverbshort {mauling|decimating|devastating|pulverizing|maiming|eviscerating|mutilating|disemboweling|dismembering|massacring|mangling|demolishing|obliterating|annihilating|terminal}

These three variables are used to track the damage. A lookup is used on the first one given your damage to find an index to the second giving us the numerical value. The third variable is used to track damage on a per hit basis so you can see a breakdown, this is mapped to a fourth variable that is created per group member where their information is stored.

#ALIAS dcadd {#additem DClist %1;#var %1 0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0;#echo %1 added to the damage counting list.}

This alias creates a string list for a given name and adds them to the list of all people you are tracking.

#ALIAS dcclear {#FO @DClist {#UNVAR %i};#VAR DClist "";#VAR DCterm 0;dcadd your;#ECHO Damagecounter reset. Please re-add groupies.}

This alias will clear the list of group members and delete the variables storing their info.

#ALIAS dcrep {#YESNO "What report would you like to show?" {Short report (total damage done and taken) :dcrep1} {Breakdown of damage verbs:dcrep2}}
#ALIAS dcrep1 {#if (!@DCreport) {dcrepto};#YESNO "Who would you like to report for?" {Yourself:#VAR DCreportfor "your"} {Everyone:#VAR DCreportfor @DClist} {Partial:#VAR DCreportfor %pick( p:Who would you like to display reports for?:, @DClist)};dctermcheck;dcavecheck;#VAR DCtemp1 0;#VAR DCtemp2 0;#VAR DCtemp3 0;#VAR DCtemp4 0;#FO @DClist {#IF {%eval( %item( @{%i}, 19) > @DCtemp1)} {#VAR DCtemp1 %item( @{%i}, 19)};#IF {%eval( %item( @{%i}, 18) > @DCtemp2)} {#VAR DCtemp2 %item( @{%i}, 18)};#ADD DCtemp3 %item( @{%i}, 19);#ADD DCtemp4 %item( @{%i}, 18)};#FO @DCreportfor {@DCreport ~|w~|Stats for %if( %i="your", Myself, %upper( %left( %i, 1))%right( %i, 1)): Dealt->%if( %item( @{%i}, 19) = @DCtemp1, ~|BC~|, ~|C~|)%item( @{%i}, 19)~|w~|~(%eval( %item( @{%i}, 19)*100/@DCtemp3)%~) Average~[~|bk~|%item( @damageverbs, %item( @{%i}, 20))~|w~|~] Taken->%if( %item( @{%i}, 18) = @DCtemp2, ~|BR~|, ~|R~|)%item( @{%i}, 18)~|w~|~(%eval( %item( @{%i}, 18)*100/@DCtemp4)%~)}}
#ALIAS dcrep2 {#if (!@DCreport) {dcrepto};#YESNO "Who would you like to report for?" {Yourself:#VAR DCreportfor "your"} {Everyone:#VAR DCreportfor @DClist} {Partial:#VAR DCreportfor %pick( p:Who would you like to display reports for?:, @DClist)};#FO @DCreportfor {@DCreport Breakdown for %if( %i="your", Myself, %upper( %left( %i, 1))%right( %i, 1)):%if( %item( @{%i}, 1), %char( 32)Tickling~(~|c~|%item( @{%i}, 1)~|n~|~))%if( %item( @{%i}, 2), %char( 32)Mauling~(~|c~|%item( @{%i}, 2)~|n~|~))%if( %item( @{%i}, 3), %char( 32)Decimating~(~|c~|%item( @{%i}, 3)~|n~|~))%if( %item( @{%i}, 4), %char( 32)Devasting~(~|c~|%item( @{%i}, 4)~|n~|~))%if( %item( @{%i}, 5), %char( 32)Pulverizing~(~|c~|%item( @{%i}, 5)~|n~|~))%if( %item( @{%i}, 6), %char( 32)Maiming~(~|c~|%item( @{%i}, 6)~|n~|~))%if( %item( @{%i}, 7), %char( 32)Eviscerating~(~|c~|%item( @{%i}, 7)~|n~|~))%if( %item( @{%i}, 8), %char( 32)Mutilating~(~|c~|%item( @{%i}, 8)~|n~|~))%if( %item( @{%i}, 9), %char( 32)Disemboweling~(~|c~|%item( @{%i}, 9)~|n~|~))%if( %item( @{%i}, 10), %char( 32)Dismembering~(~|c~|%item( @{%i}, 10)~|n~|~))%if( %item( @{%i}, 11), %char( 32)Massacring~(~|c~|%item( @{%i}, 11)~|n~|~))%if( %item( @{%i}, 12), %char( 32)Mangling~(~|c~|%item( @{%i}, 12)~|n~|~))%if( %item( @{%i}, 13), %char( 32)Demolishing~(~|c~|%item( @{%i}, 13)~|n~|~))%if( %item( @{%i}, 14), %char( 32)Obliterating~(~|c~|%item( @{%i}, 14)~|n~|~))%if( %item( @{%i}, 15), %char( 32)Annihilating~(~|c~|%item( @{%i}, 15)~|n~|~))%if( %item( @{%i}, 16), %char( 32)Terminal~(~|c~|%item( @{%i}, 16)~|n~|~))}}

These three aliases will display all the information that has been tracked. The first alias will ask you if you would like to just show the total and average damage (dcrep1) or a breakdown of all the hits (dcrep2).

Will add more about this trigger/alias set at a later time.