You're resetting the %modes var each time in this line:

Code:
var %modes = MODE %i - PARAM: $gettok($2-,%mode_param,32)


Change it to read:

Code:
var %modes = %modes MODE %i - PARAM: $gettok($2-,%mode_param,32)