[color:green]; sockread event[/color]
on *:SOCKREAD:[color:blue]sockname[/color]: {
[color:green]; read from sock and tokenize for easy access[/color]
sockread %tmp
tokenize 32 %tmp
[color:green]; check for all conditions:[/color]
[color:green]; * must be a channel msg (= regular text)[/color]
[color:green]; * the word is must be an actual word and not part of one[/color]
if ($2 == PRIVMSG) && ($3 ischan) && (* is * iswm $4-) {
[color:green]; find out which token number the word is is[/color]
var %x = $findtok($4-,is,1,32)
var %y = $calc(%x + 1)
var %z = $calc(%x - 1)
[color:green]; write to inifile[/color]
[color:green]; use of $+() to reconstruct $4-x[/color]
[color:green]; use of $eval() to evaluate it[/color]
[color:green]; note the use of $right(...,-1) because the message is always prefixed with a colon[/color]
writeini [color:blue]filename.ini[/color] is $right($eval($+($,4-,%z),2),-1) $eval($+($,%y,-),2)
}
}