$puttok
From Scriptwiki
Revision as of 20:06, 17 October 2005 by Albie (talk | contribs) (Replaced example to stop users using findtok and puttok to replace and added also see reptok section.)
Overwrites the Nth token in text with a new token.
$puttok(text,token,N,C)
Note that you can specify a negative N.
Example
echo -ag $puttok(This is a moo, test, 4, 32)
This example replaces moo with test and therefor echo's This is a test.
var %botinfo = Nick JoinTime Admin if (!%admin) { set %botinfo $puttok(%users.1,$nick,3,No) } else { set %botinfo $puttok(%users.1,$nick,3,Yes) } echo -ag %botinfo
This example depending upon if %admin is $true or $false sets the third word in %botinfo to Yes or No.
Varibles set: %gather_info = L,Q,G,O,F,S,P,Dana myserver.com 12345 10 ;;Players Server Port MaxPlayers on *:PART:#GatherChan: { var %tmp.nicks = $gettok(%gather_info,1,32) ;;Get nicknames into a temporary variable. if ($istok(%tmp.nicks,$nick,44)) { ;;If nickname is in gather ... set %tmp.nicks $remtok(%tmp.nicks,$nick,44) ;; remove them. set %gather_info $puttok(%gether_info,%tmp.nicks,1,32) ;;Update %gather_info's first token with the players that are left. } }