Hi,

you could organise your .ini file like this:

[scores]
nick1=522
nick2=899
nick3=....
...

Then use this alias (I believe qwerty was the first to use this approach):
Code:
 
alias topscore {
  window -h @scores 
  filter -fwxute 2 61 scores.ini @scores [scores]
  var %a = 1
  while (%a < 11) && $line(@scores,%a) { tokenize 61 $ifmatch | echo -a %a -> $1 with $2 points | inc %a }
  window -c @scores
}

Replace echo -a with whatever suits you best.

Short explanation of the code:

The contents of scores.ini are filtered into a hidden window @scores using the /filter command and following flags:

f --> the infile is a file (scores.ini)
w -> the outfile is a window (@scores)
x --> the x flag excludes lines that match the matchtext [scores]
u --> perform a numeric sort
e --> make the sort descending: from highest to lowest
t --> makes the filter command sort the file based on a column (C) and seperator (S). In the ini file, the first column is the one with the nicks, the second column are the scores. The columns are seperated by a = which is $chr(61). So we filter scores.ini on on column 2 with seperator 61.

Hope this helps you on your way,

Greets

Last edited by FiberOPtics; 21/06/04 02:51 PM.