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
nastasim
Beginner


Joined: 08 Jun 2004
Posts: 10

PostPosted: Mon Nov 08, 2004 9:16 pm   

Group Stats Trigger Help
 
Hi, I am interested in capuring data (mana, hit points, and movement) from a groupstats command. Some of the things I am interested in doing are:
1. Sort the clerics by Max Mana, setting a variable for each cleric (CMM1 to CMMX) with CMM1 having the most Max Mana.
2. Sort the clerics by Current Mana, setting a variable for each cleric (CCM1 to CCMX) with CCM1 having the most Current Mana.
3. Count the number of players down 100 hp or more and set that number into a variable (d100).
4. Compute how many hp the group is down (sum of each MaxHP-CurrHP).
5. Locate the player down the most hit points (Max hp - Curr hp) and set that player name, and number of hit points down into variables dName and dHP.
I probably will do the same for mages, and something for movement but this is a start. What I am not sure about is how to go about getting all this data.

Here is what the data from a groupstats report looks like:

groupstats
Group Statistics:
[ T 50 ] Meriadoc - HP: 476/1470 Move: 396/396
[ W 50 ] Fallos - HP: 1850/1850 Move: 224/224
[ T 50 ] Imho - HP: 1290/1290 Move: 260/260
[ C 50 ] Iny - HP: 1034/1035 Move: 224/224 Mana: 25/771 (100)
[ C 50 ] Galadriel - HP: 830/ 830 Move: 231/231 Mana: 200/579 (100)
[ M 50 ] Tingeling - HP: 304/ 506 Move: 157/157 Mana: 328/328 (0)
[ M 50 ] Ceres - HP: 928/ 928 Move: 193/193 Mana: 756/756 (100)
[ M 50 ] Hertz - HP: 709/ 709 Move: 368/368 Mana: 406/406 (100)
[ M 50 ] Duke - HP: 862/ 903 Move: 173/173 Mana: 721/721 (100)
[ M 50 ] Burn - HP: 836/ 836 Move: 205/205 Mana: 776/776 (100)
[ M 50 ] Mao - HP: 890/ 892 Move: 220/220 Mana: 755/755 (35)
[ M 50 ] Erin - HP: 817/ 822 Move: 247/247 Mana: 403/443 (100)
[ M 50 ] Elrond - HP: 844/ 844 Move: 220/220 Mana: 725/725 (75)
[ M 50 ] Janie - HP: 792/ 792 Move: 173/173 Mana: 754/754 (100)
[ M 50 ] Keano - HP: 774/ 812 Move: 323/323 Mana: 436/436 (100)
[ M 50 ] Bagpuss - HP: 895/ 943 Move: 193/193 Mana: 728/738 (100)
[ M 50 ] Warlock - HP: 786/ 786 Move: 228/228 Mana: 490/490 (100)
[ M 50 ] Mytel - HP: 814/ 829 Move: 288/288 Mana: 662/662 (0)

What is the best way to go about this?
Thank you,
Mario
Reply with quote
misterbalrog
Apprentice


Joined: 26 Oct 2004
Posts: 108

PostPosted: Mon Nov 08, 2004 9:45 pm   
 
Hmm.. in theory, make a trigger that reacts on a generic expression of a row, drawing each variable that you deem necessary, push it into a list or a database. Use %sort for the sorting in each variable-type.

Perhaps #gag all captured lines, then #say/#echo the said result with your preferred formatting.

I think once you get all the variables down in a list or database in a manageable format, it'll be rolling downhill from there. However, I'm too lazy to do this :P
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Mon Nov 08, 2004 10:24 pm   Re: Group Stats Trigger Help
 
nastasim wrote:
Hi, I am interested in capuring data (mana, hit points, and movement) from a groupstats command. Some of the things I am interested in doing are:
1. Sort the clerics by Max Mana, setting a variable for each cleric (CMM1 to CMMX) with CMM1 having the most Max Mana.
2. Sort the clerics by Current Mana, setting a variable for each cleric (CCM1 to CCMX) with CCM1 having the most Current Mana.
3. Count the number of players down 100 hp or more and set that number into a variable (d100).
4. Compute how many hp the group is down (sum of each MaxHP-CurrHP).
5. Locate the player down the most hit points (Max hp - Curr hp) and set that player name, and number of hit points down into variables dName and dHP.
I probably will do the same for mages, and something for movement but this is a start. What I am not sure about is how to go about getting all this data.

Here is what the data from a groupstats report looks like:

groupstats
Code:
Group Statistics:
[ T  50 ] Meriadoc        - HP:  476/1470  Move: 396/396
[ W  50 ] Fallos          - HP: 1850/1850  Move: 224/224
[ T  50 ] Imho            - HP: 1290/1290  Move: 260/260
[ C  50 ] Iny             - HP: 1034/1035  Move: 224/224  Mana:  25/771 (100)
[ C  50 ] Galadriel       - HP:  830/ 830  Move: 231/231  Mana: 200/579 (100)
[ M  50 ] Tingeling       - HP:  304/ 506  Move: 157/157  Mana: 328/328 (0)
[ M  50 ] Ceres           - HP:  928/ 928  Move: 193/193  Mana: 756/756 (100)
[ M  50 ] Hertz           - HP:  709/ 709  Move: 368/368  Mana: 406/406 (100)
[ M  50 ] Duke            - HP:  862/ 903  Move: 173/173  Mana: 721/721 (100)
[ M  50 ] Burn            - HP:  836/ 836  Move: 205/205  Mana: 776/776 (100)
[ M  50 ] Mao             - HP:  890/ 892  Move: 220/220  Mana: 755/755 (35)
[ M  50 ] Erin            - HP:  817/ 822  Move: 247/247  Mana: 403/443 (100)
[ M  50 ] Elrond          - HP:  844/ 844  Move: 220/220  Mana: 725/725 (75)
[ M  50 ] Janie           - HP:  792/ 792  Move: 173/173  Mana: 754/754 (100)
[ M  50 ] Keano           - HP:  774/ 812  Move: 323/323  Mana: 436/436 (100)
[ M  50 ] Bagpuss         - HP:  895/ 943  Move: 193/193  Mana: 728/738 (100)
[ M  50 ] Warlock         - HP:  786/ 786  Move: 228/228  Mana: 490/490 (100)
[ M  50 ] Mytel           - HP:  814/ 829  Move: 288/288  Mana: 662/662 (0)


What is the best way to go about this?
Thank you,
Mario


By the look of things the best way is with a relatively open trigger. That parses out all the data. It will take me a while so check back later.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Mon Nov 08, 2004 11:27 pm   
 
Jobs done.

I didn't use seperate variables for the CCM/CMM. Each is in a single list, use %item to get specific entries. Since you didn't specify a variable for the sum of down hp's I named it GroupDHP. All down hp numbers are in negative values, if you really care about having them positive you can do the %abs at the end with the %sort's

Code:
#CLASS {GroupCapture}
#VAR Group {} {}
#VAR TempGroup {} {}
#VAR d100 {} {}
#VAR dName {} {}
#VAR dHP {} {}
#VAR GroupDHP {} {}
#VAR MMM {} {}
#VAR MCM {} {}
#VAR CMM {} {}
#VAR CCM {} {}
#TRIGGER "GroupDataCap" {Group Statistics:} {Group=""}
#COND {} {#IF (%begins(%line,"[")) {TempGroup=%subchar(%line," []()","|");#DELITEM TempGroup {};#DELNITEM TempGroup %numitems(@TempGroup);#DELNITEM TempGroup 2;#ADDITEM TempGroup {%pop(TempGroup)};TempGroup=%replace(@TempGroup,"|"," ");TempGroup=%replace(@TempGroup,"/ ","/");TempGroup=%replace(@TempGroup," - ","=");#ADDKEY Group {@TempGroup}} {#STATE GroupDataCap 2;#SET GroupDataCap 2 1}} {looplines|param=99}
#COND {} {d100=0;dName="";dHP=0;GroupDHP=0;MMM="";MCM="";CMM="";CCM="";#LOOPDB @Group {#IF (%word(%val,%numwords(%val))="M") {#ADDITEM MMM {%rightback(%concat("0000",%word(%word(%val,6),2,"/")),5)-%key};#ADDITEM MCM {%rightback(%concat("0000",%word(%word(%val,6),1,"/")),5)-%key}};#IF (%word(%val,%numwords(%val))="C") {#ADDITEM CMM {%rightback(%concat("0000",%word(%word(%val,6),2,"/")),5)-%key};#ADDITEM CCM {%rightback(%concat("0000",%word(%word(%val,6),1,"/")),5)-%key}};TempGroup=%eval(%replace(%word(%val,2),"/","-"));#ADD GroupDHP @TempGroup;#IF (@TempGroup<@dHP) {dName=%key;dHP=@TempGroup};#IF (@TempGroup<-100) {#ADD d100 1}};MMM=%sort(@MMM,1);MCM=%sort(@MCM,1);CMM=%sort(@CMM,1);CCM=%sort(@CCM,1)} {manual}
#CLASS 0
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
nastasim
Beginner


Joined: 08 Jun 2004
Posts: 10

PostPosted: Thu Nov 11, 2004 7:06 pm   
 
Vijilante, I copied this into the command line and it works. Now I am trying to figure out how it works :)
Thanks very much for your reply!
Mario
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