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
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Wed Nov 09, 2005 8:53 pm   

Question based off %max()
 
Cut down version of what i am working with for simplicities sake:
#VAR ClanMembers {Abelinc|Accora} {} "RollCall"
#VAR myranks {myrank1|myrank2} "RollCall"
#VAR myrank1 {Abelinc1493Accora799} {_nodef} "RollCall"
#VAR myrank2 {Abelinc563Accora850} {_nodef} "RollCall"

Bleh, there's supposed to be those lil boxes between the words and #'s in the myrank1&2 stuff. silly board dont let them show

Trying to implement something like this:

%min(%replace(@myrank1.@ClanMembers,"|",","))

Output:
Code:
_________________________
Members     |  #1 |  #2 |
------------|-----|-----|
Abelinc     | 1493|  563|
Accora      |  799|  850|


The lowest #'s for each each rank is supposed to be red (aard uses @R for red color)

Everything works great report wise except i havent been able to figure out how to get it to look inside the var correctly and color the lowest # of each rank.
How would I do this?
I think the # inside the var would be the part to be colored rather than have it done when it's being out put.
Not sure whats best in this case
_________________
http://www.Aardwolf.com
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Nov 09, 2005 9:48 pm   
 
You are using a record variable instead of a list, so the shortcut won't work. You should use another variable to record the higest or lowest in each category. When seeking the highest set the variable to 0 when seeking the lowest set the variable to some extreme number; then use #LOOPDB and check the %val against your variable and reset the variable accordingly. Finally when you produce your output check for = to variable and color accordingly. It is a price of the data structure you used to store the data.

An alternate data structure would be your ClanMembers list, then a list for each ranking category that is ordered to match the ClanMembers order (use %additem and better timed triggers). This allows you to generate the min and max values easily for any given ranking, while maintaining the coordination between names and rank value; without the duplication and triplification of names in your variables.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Wed Nov 09, 2005 11:09 pm   
 
Using %expandb with a few other functions Its possible to return the vals as a stringlist, Give me a few to dig through my scripts to try and find it.
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Thu Nov 10, 2005 12:08 am   
 
#ADDITEM MYVAR Low 1
#ADDITEM MYVAR High 20
#ADDITEM MyVAR Mid 10

#FUNC dbtolist {%replace(%subregex(%expanddb("%1",%if(%null("%2"),"|","%2")," "),"[a-zA-Z_-]","")," ","")}

#SAY @dbtolist(@MYVAR)
return a stringlist of numeric vals
#SAY @dbtolist(@MYVAR.",")
return a comma seperated list
#SAY %min(@dbtolist(@MYVAR,","))
return the %min of a comma seperated list

Its rude, its crude, but it works assuming the KEY only contains A-Z underscore and dash and the VAL is a number only. I am still fairly new to regex so there is prolly a better regex that can be used in fact I know there is (watch for edits to this post)

[Edit: Made the function a little more usuable]
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Thu Nov 10, 2005 4:01 am   
 
Vij, if it matters there will never be any dupes in name vals. Like myrank1 Abelinc and myrank1 Accora will NEVER both have the same #
But i'll be honest I have NO clue what yer talking about..I know that it should be obvious to me, but i read what you said like 10 times and all i could think was "What?"

AWESOME NEXELA GETS A GREAT BIG <3 for helping me figure out how to get it to work perfectly.
_________________
http://www.Aardwolf.com
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