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
Jah
Wanderer


Joined: 11 Oct 2000
Posts: 52
Location: Sweden

PostPosted: Thu Jul 03, 2003 5:37 am   

%sort
 
Can %sort sort more then just initial number?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Jul 03, 2003 3:45 pm   
 
%sort can sort the members of a list. It doesn't seem to have any limit on the size of the list, but everything being sorted would have to be in the same list.

I hope that answers your question, since I couldn't understand what you're asking. I don't see any reference to "initial number" in the explanation of %sort.
Reply with quote
Jah
Wanderer


Joined: 11 Oct 2000
Posts: 52
Location: Sweden

PostPosted: Thu Jul 03, 2003 4:35 pm   
 
Hmm a list can only sort the first number. A sorted list will be like
5|2000|121

I want it to sort it like
2000|121|5
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Jul 03, 2003 8:55 pm   
 
Oh, you want to sort numbers. No, %sort can't sort by numerical value. It's based on alphabetical order, and alphabetical order is determined by the initial character (actually by the first non-identical character of two items). You'll have to create your own routine to sort by numerical value.
Reply with quote
Jah
Wanderer


Joined: 11 Oct 2000
Posts: 52
Location: Sweden

PostPosted: Thu Jul 03, 2003 10:01 pm   
 
Ok so im screwed then. :)
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Jul 04, 2003 5:09 am   
 
No, just because there's not a built-in function doesn't mean it's impossible. It just means you'll have to be more creative.

For instance, you could use two lists and then take the highest value from the first list using %max, add it to the second list using #ADDITEM or %additem, and then delete it from the first list using #DELITEM or %delitem (use #ADDI/#DELI if duplicate values aren't desired, %additem/%delitem if they are). Repeat until all values are removed from the first list, at which point your sorted values will be in the second list.
Reply with quote
Jah
Wanderer


Joined: 11 Oct 2000
Posts: 52
Location: Sweden

PostPosted: Fri Jul 04, 2003 3:04 pm   
 
Man. Thats genious. Thank you :)
Reply with quote
PathetiC
Newbie


Joined: 10 Sep 2001
Posts: 6
Location: Sweden

PostPosted: Fri Dec 05, 2003 2:59 pm   
 
quote:
Originally posted by LightBulb

No, just because there's not a built-in function doesn't mean it's impossible. It just means you'll have to be more creative.

For instance, you could use two lists and then take the highest value from the first list using %max, add it to the second list using #ADDITEM or %additem, and then delete it from the first list using #DELITEM or %delitem (use #ADDI/#DELI if duplicate values aren't desired, %additem/%delitem if they are). Repeat until all values are removed from the first list, at which point your sorted values will be in the second list.



I wasn't the one starting this topic.. But I was having major troubles with the same issue.. Tried to make an average damage counter.. To show who in group did the most damage.. Thanks for tipping me off on the %max() command..
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