Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #16  
Old 11-22-2009, 04:15 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by Switch View Post
Jer, I think you were a little messed up with your loop and setting the variable as temp.g.kills, because based off what Chris posted you need to save it as a subvariable in the array, though I've never used array.sortbyvalue() before.
The code I posted works, as I tested it successfully.

This is basically what you'll need, you've tried enough to deserve it.

PHP Code:
public function getTop5() { 
  
// Initialize Array and Kills Structure  
  
temp.guildzname getGuildList();  
  
// Loop and Record Kills in the Array Member's sort variable  
  
for (temp.gtemp.guildzname) {  
    
temp.g.kills this.guilds.(@temp.g).kills;  
  }
  
// Sort 
  
temp.guildzname.sortbyvalue("kills"nullfalse);
  
// Loop through Sorted Data
  
for (temp.0temp.5temp.i++) {
    
// Determine Variables
    
temp.temp.guildzname[temp.i];
    
temp.kills this.guilds.(@temp.g).kills;
    
temp.str = (temp."'s kills: " temp.kills);
    
// Add formatted string to data array
    
temp.data.add(temp.str);
  }
  
// Return the data array  
  
return temp.data;  

__________________
Quote:
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:24 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.