Thread: Sorting
View Single Post
  #20  
Old 11-22-2009, 04:23 AM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by fowlplay4 View Post
The code I posted works, as I tested it successfully.
Well sort by value's 3rd param, in your posted script just now, has to be true for descending value.
But anyways.

PHP Code:
public function getTopAbyss(){
  
temp.guilds getGuildList();
  for (
temp.temp.guilds) {
    
temp.g.kills this.guilds.(@temp.g).kills;
  }
  
temp.guilds.sortbyvalue("kills"nulltrue);
  echo(
temp.guilds);

Echoed
NPC Code:
The script of NPC db_registeredguilds has been updated by Switch
Wolfs,Owner,Poop,SDE,BTK
The script of NPC db_registeredguilds has been updated by Switch
BTK,SDE,Poop,Wolfs,Owner
The script of NPC db_registeredguilds has been updated by Switch
SDE,BTK,Wolfs,Owner,Poop



While this
PHP Code:
public function getTopAbyss(){
  
temp.guilds getGuildList();
  for (
i=0i<temp.guilds.size(); i++) {
    
temp.guilds[i].kills this.guilds.(@temp.guilds[i]).kills;
  }
  
temp.guilds.sortbyvalue("kills"nulltrue);
  echo(
temp.guilds);

Echoed
NPC Code:
The script of NPC db_registeredguilds has been updated by Switch
BTK,Poop,Owner,Wolfs,SDE
The script of NPC db_registeredguilds has been updated by Switch
Owner,BTK,Poop,Wolfs,SDE
The script of NPC db_registeredguilds has been updated by Switch
Owner,BTK,Poop,Wolfs,SDE


Note that BTK, Owner, and Poop all have 0 kills, so they can have a random order, and Wolfs has 2 kills and SDE has 22 kills.
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote