First off, .set limit. $+ $chan $2 doesn\'t work that way for dynamic variables,
I suggest using
.set $+(%,limit,.,$chan) $2
Same with your other variables.