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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
panor
Newbie


Joined: 13 Aug 2002
Posts: 8

PostPosted: Tue Aug 13, 2002 1:09 am   

over all groupies damage counter
 
*take breath*
my goal is to create a counter that will take and use the values i have assigned to each set of damage values (IE. mangle, MANGLE, *MANGLE*) and so on. its around 15 or so, different damage names. With about 5 different kinds of damage for each name. Totaling around 100. (eg. mangle = 1025, *MANGLE* = 1282)

Now my friend has a counter that counts the damage done for each different group member and assigns values (numbers instead of words) for each one. Then his counter totals the lot and says what percent each group member contributed as a whole compared to other group members (each group member added together would add up to 100%)

My friend is not sharing the counter with me and im knowledgeable enough to make a damage counter for myself. when it comes to ismember things i get lost and the one paragraph in zmud really doesn't help me.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Aug 13, 2002 1:37 am   
 
I will take a stab at this, however since you have been somewhat vague, I will also be somewhat vague. There is nothing a computer programmer hates more then incomplete program specification, anyhow.

#TR {^Your attack ({@DamWords}) *%p$} {DamCounts=%replaceitem(%eval(%number(%item(@DamCounts,%ismember("%1",@DamWords)))+1),%ismember("%1",@DamWords),@DamCounts);#ADD DamCount 1} "" {case}
#AL ResetDamCounts {DamCounts=%concat(%repeat("0|",%eval(%numitems(@DamWords)-1)),"0");DamCount=0}
#AL DisplayDams {#LOOP 1,%numitems(@DamWords)) {#ECHO %item(@DamWords,%i):%eval(%number(%item((@DamCount,%i))*100/@DamCount)~%:%eval(%number(%item((@DamCount,%i))*%number(%item(@DamVals,%i)))}}
#VAR DamWords {mangle|MANGLE,*MANGLE*}
#VAR DamCount 0
#VAR DamCounts {0|0|0}
#VAR DamVals {1025|1153|1282}

Now all you have to do is coordinate the values and the words. The perentages I have it calculating are based on frequency of that type, the damage total will likely exceed the coded limit for integer math very quickly so you may want to look at redesigning it based on the bignumber solution I posted a few times recently.
Reply with quote
panor
Newbie


Joined: 13 Aug 2002
Posts: 8

PostPosted: Tue Aug 13, 2002 2:17 am   
 
sorry i was a little vague.. here are some lines from the game

A wandering peasant's attacks strike you 2 times, with ***EVISCERATING*** intensity!

Your attack strikes A wandering peasant 1 time, with ***MAIMING*** passion!

zoro's attacks strike A wandering peasant 3 times, with **DISEMBOWELING** passion!

blah's attacks strike A wandering peasant 3 times, with **MANGLING** passion!

now the counter my friend showed me. showed something like this after an entire run

panor(your) hit for 51000 points for a total of 30.2% of the damage

zoro hit for 30000 points for a total of 10.3% of the damage

and so on for everyone(numbers made up)
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Aug 13, 2002 4:27 am   
 
Ah, so you seek to count on a per fight basis. Changing the trigger to count it up is not a problem, however you never said how to tell when to zero the counters, and when to report the results.

#VAR DamWords {mangle|MANGLE|*MANGLE*}
#VAR DamVals {1025|1153|1282}
#VAR DamTotal 0
#VAR CharName {panor}
#VAR PlayerFighters {}
#TR {^(%w) attack{s|} strike{s|} *, with (%w) passion!$} {#IF ("%1"="Your") {#ADD @CharName %item(%@DamVals,%ismember("%2",@DamWords));#ADDITEM PlayerFighters @CharName} {#ADD %1 %item(%@DamVals,%ismember("%2",@DamWords));#ADDITEM PlayerFighters "%1"}}
#ALIAS DisplayDam {DamTotal=0;#FORALL @PlayerFighters {#ADD DamTotal @{%i}};#FORALL @PlayerFighters {say %i hit for @{%i} points for a total of %eval(@{%i}*100/@DamTotal).%mod(%eval(@{%i}*1000/@DamTotal),10)~% of the damage.;#UNVAR %i};PlayerFighters=""}

I have the display alias removing the extra variables it creates, if you happen to use variables that will results in a naming conflict then further tweaks could be done to put them in an independent class. You would still have to fill in all the words and the values you want to use.
Reply with quote
panor
Newbie


Joined: 13 Aug 2002
Posts: 8

PostPosted: Tue Aug 13, 2002 11:23 pm   
 
very close and thank you .. i think the problem im having is picking up the (**MANGLE**) it seems to pick up (mangle) but not anything with a (*) also when he does pick up the damage without any stars its its not working in some way. when i displaydam i get zero's. It does seem to make a list of groupies though i haven't tested it on a run with others so far. i have put in the entire list of damages i have, and in the same order the amount of value each on is worth in the two different values you set up. numbers in one .. names in another. im so close and i thank you so much for your help. i'll include some more lines

Your attacks strike A sleeping monk 3 times, with *DISMEMBERING* force!

Your attacks strike A sleeping monk 2 times, with DISEMBOWELING brutality!

the force and brutality don't matter.
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Tue Aug 13, 2002 11:29 pm   
 
#TR {^(%w) attack{s|} strike{s|} *, with (%x) %w!$} {#CO 31;#IF ("%1"="Your") {#ADD @CharName %item(%@DamVals,%ismember("%2",@DamWords));#ADDITEM PlayerFighters @CharName} {#ADD %1 %item(%@DamVals,%ismember("%2",@DamWords));#ADDITEM PlayerFighters "%1"}}


No * word captured as the pattern matches words. I added the line coloring so you
can see what it matches and what it doesn't match. Also changed
the end to match any word.

And make sure your variable DamWords has all the words in it.
#VAR DamWords {word|WORD|*WORD*|word2|WORD2|*WORD2*|etc|ETC|*ETC*}

Ton Diening
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Aug 14, 2002 3:44 am   
 
Keeping with Ton's improvements, I found a typo in my original script that was carried forward that would explain why it is just popping out 0's.
It is corrected below.

#TR {^(%w) attack{s|} strike{s|} *, with (%x) %w!$} {#CO 31;#IF ("%1"="Your") {#ADD @CharName %item(@DamVals,%ismember("%2",@DamWords));#ADDITEM PlayerFighters @CharName} {#ADD %1 %item(@DamVals,%ismember("%2",@DamWords));#ADDITEM PlayerFighters "%1"}}
Reply with quote
panor
Newbie


Joined: 13 Aug 2002
Posts: 8

PostPosted: Thu Aug 15, 2002 12:13 am   
 
well done you guys. i have to change what your triggers did a little for what i wanted (not reset when i look at it)(only track the people that i want tracked, ie not another group in the same room) after my changes though i notice that the trigger is creating variables for each name eg. (kalor = 1490) its also creating them in the main folder. i'd like to have them created in my 'group damage' folder and i can't seem to find a trigger that will delete them for me when i like. So i dont get left over variables for different players im not showing
for example i still have (faraday = 345) but faraday is not in my list. faraday is left over from another time i was counting.
i saw that you used #unvar in your trigger to take out just that name from the list of groupfighters. im considering making a list like this one variable player =faraday|kalor|timmy
and having another
variable damages = 13445|1234|2345

but im still learning from what you gave me how to do that.

For now im happy with it just creating the variables for each persons name and giving it the value of damage they are doing. How 'other then manually' do i delete them using an alias?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Aug 15, 2002 2:57 am   
 
The code overhead for doing that way is relatively small, first use the PlayerFighters I already put in, since ADDITEM will not add a duplicate it provides that they will stay where they are. So you can check to see if the number of items in your damage list matches the number in the player list, if not then you use %additem (it allows duplicates) to place the damage value for the new player. If they match then you would use %ismember and %replaceitem to update the values.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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