Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Rankings (https://forums.graalonline.com/forums/showthread.php?t=86346)

Pelikano 06-14-2009 06:06 PM

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

fowlplay4 06-14-2009 06:31 PM

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 );



Pelikano 06-14-2009 06:53 PM

Thank you very much!


All times are GMT +2. The time now is 05:01 AM.

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