Code:
if ($read(moves.txt,s,$nick)) { var %rn = $+(-l,$readn), %sol = $calc($gettok($ifmatch,2,58) + %moves) }
write %rn moves.txt $nick $+ : $iif(%sol,%sol,%moves)



I don't use text files, ini would probably server you better here, but this should do what you want.

Quote:

This will check if the nick exists in your text file.

if($read(moves.txt,s,$nick))

If it does it sets two local variables.

var %rn = $+(-l,$readn)
This saves the line number so you know which line to overwrite. -l#

This adds their new score to their old score.
%sol = $calc($gettok($ifmatch,2,58) + %moves)

Then, regardless if the nick matched or not, it write their score to the file.

write %rn moves.txt $nick $+ : $iif(%sol,%sol,%moves)

This writes to the specified line %rn has saved if it exists. If %sol exists it writes this solution instead of the recently gained score.

$iif(comparison is $true,Do This,Else Do This)



Hope this helps. smile