mIRC Home    About    Download    Register    News    Help

Print Thread
#4069 30/12/02 05:53 AM
Joined: Dec 2002
Posts: 40
L
Lucifer Offline OP
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Dec 2002
Posts: 40
Code:
scoresort {
  var %i = 1
  write -c sc.txt
  while ($hget(scores,0).item >= %i) { write -c sc.txt $read(sc.txt,1) $+ $hget(scores,%i).data $hget(scores,%i).item $+ , | inc %i }
  var %b = $sorttok($read(sc.txt,1),44,rn)  
  hfree scores
  hmake scores  
  var %c = 1
  while (%c <= $numtok(%b,44)) { hadd scores $gettok($gettok(%b,%c,44),2,32) $gettok($gettok(%b,%c,44),1,32) | inc %c }
}

the hash tables are saved as Nick Score. I put an echo after the second while loop and everything is echos to my status window in the right order but when I take the echo out and run the alias they aren't saved into the hashtable in the right order

#4070 30/12/02 06:10 AM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Hash tables aren't sorted. If you want to make them sorted, add the data using n1 n2 n3 n4 n5 n6 as the item and nick score as the data. That way you can l loop through while ($hget(scores,$+(n,%i))) and retrieve the data that way in the order you want them.


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#4071 30/12/02 06:19 AM
Joined: Dec 2002
Posts: 40
L
Lucifer Offline OP
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Dec 2002
Posts: 40
But it saves them in the order I want them.


Link Copied to Clipboard