Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-14-2009, 06:06 PM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
Rankings

Hi.

I have this Array:

PHP Code:
this.rankings = {{300player.account}, {245player.account}, {439player.account}}; 
And I want to sort it so I have this:

PHP Code:
this.rankings = {{245player.account}, {300player.account}, {439player.account}}; 
My problem is that I have no idea how to do this, =P
Reply With Quote
  #2  
Old 06-14-2009, 06:31 PM
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
Use Novo's math-sort class:
http://forums.graalonline.com/forums...ad.php?t=74117

and the following code:

PHP Code:

function onCreated() {

  
// Join Sort Class
  
join("math-sort");

  
// Echo Before..
  
this.rankings = {{300player.account}, {245player.account}, {439player.account}};
  echo(
this.rankings);

  
// Declare compareTo method.
  
temp.func = function(sideAsideB)
  {
    return ( 
sideA[0] < sideB[0] );
  };

  
// Echo After
  
temp.sorted sortListthis.rankingstemp.func );
  echo( 
temp.sorted );

__________________
Quote:
Reply With Quote
  #3  
Old 06-14-2009, 06:53 PM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
Thank you very much!
Reply With Quote
Reply


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 12:05 AM.


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