If you want to stack multiple values to a single string, you can do a nested string of tokenized item:values.
I use space for the outer token, and colon for the inner token.
kills:5 deaths:2 kd:2 wins:9 losses:8 gulag:6 items:589And then I use a combination of $wildtok(%string,wins:*,1,32) to get the item:value token, and then $gettok(%token,2,58) to extract the value from the item:value pair. 58 is the ascii value of colon (:).
var %username = $nick
var -s %toks = $hget(MyTable,%username)
>> kills:5 deaths:2 kd:2 wins:9 losses:8 gulag:6 items:589
var -s %tok = $wildtok(%toks,wins:*,1,32)
>> wins:9
var -s %wins = $gettok(%tok,2,58)
>> 9
inc -s %wins 1
>> 10
var %newtok = wins: $+ %wins
>> wins:10
var %toks = $reptok(%toks,%tok,%newtok,1,32)
>> kills:5 deaths:2 kd:2 wins:10 losses:8 gulag:6 items:589
hadd MyTable %username %toks
Now, you can also write a function that does all this in one go, so you can just use that simple function everywhere else in your code instead of repeating each of these steps each time. But I'll leave that to you, since it's half the fun. I would advise creating a function to increment a named value, decrement a named value, get and add/overwrite a named value. You can even do this by writing one main support function and then 4 wrapper-functions above it. Go nuts!
There are other ways, such as using $regsubex() or $regex() and $regml() or $regmlex(), but it's more convoluted and often slower and harder to read / debug.
Hope this help.
Quick tip: Instead of hard-coding "wins:" you will want to use a variable %stat that contains the word "wins", so this is what that looks like.
from: var -s %tok = $wildtok(%toks,wins:*,1,32)
to..: var -s %tok = $wildtok(%toks,%stat $+ :*,1,32)
from: var %newtok = wins: $+ %wins
to..: var %newtok = %stat $+ : $+ %value
or..: var %newtok = $+(%stat,:,%value)