Hi,
Usage:
/mystats <table> will list the contents of the specified table
/mystats <category> <number> will list the items that have a value from the specified category, lower than the specified number.
Example:
Hash Table: stats
Item + data:
John 20 1000
Jane 35 800
Jake 80 2000
Janis 44 560
...
There are 2 categories, in our example the first column next to the nicks, and the second column.
/mystats stats 1 50 -> will list the nicks with a value lower than 50 based on category 1
/mystats stats 2 1000 -> will list the nicks with a value lower than 1000 based on category 2
etc.
alias mystats {
if $1 == $null { echo -a * You must specify a hash table. | return }
if !$hget($1) { echo -a * This hash table doesn't exist. | return }
if $2 == $null {
echo -a Listing contents of hash table $1:
var %a = 1
while $hget($1,%a).item { echo -a $v1 -> $hget($1,%a).data | inc %a }
}
else {
if !$3 { echo -a * You must specify a number to compare. | return }
if $2 !isnum 1- $+ $numtok($hget($1,1).data,32) {
echo -a * You must specify a category between $v2
return
}
window -h @@
var %a = 1, %b = $calc($2 + 1), %c
while $hget($1,%a).item { aline @@ $v1 $hget($1,%a).data | inc %a }
filter -wwtc %b 32 @@ @@ *
echo -a Listing players - Category: $2 - Lower than: $3
%a = 1
while $gettok($line(@@,%a),%b,32) <= $3 { echo -a $line(@@,%a) | inc %a | inc %c }
if !%c { echo -a No players found. }
window -c @@
}
}
Hope you find this somewhat useful,
Greets