Little example for you, it's not much..
alias scores {
;the table doesnt exist so we make one.
if (!$hget(scores)) hmake scores 100
linesep
;adding the nicknames with their points in our table.
hadd scores Andy 10
hadd scores Bob 25
hadd scores Riamus 35
hadd scores Mike 50
;this tells us how many users have points in this case we'd get (4)
echo -a $+($chr(40),$hget(scores,0).item,$chr(41)) items in table.
echo -a Listing...
;We loop through all the users and echo the item and data.
;Item would be their nick. Data would be their points.
var %x = $hget(scores,0).item
while (%x) {
echo -a $hget(scores,%x).item with $hget(scores,%x).data points
dec %x
}
hsave -i scores scores.dat
linesep
}
We'd get the following data back.
-
(4) items in table.
Listing...
Mike with 50 points
Riamus with 35 points
Andy with 10 points
Bob with 25 points
-
To free the table you type /hfree scores.
As it stands you're writing the scores to a file (scores.dat).
With (/hsave -i scores scores.dat)
The -i switch means we're saving in INI format as you already are.
For more help type
/help Hash Tables.Hope this helps,
-Andy.