good but, begin a line with \";\" to exlude it from the code also you can replace
if ($1 == +m) { mode $chan $2 +m } upto... if ($1 == -mir) { mode $chan $2 -mir }
with
if ($regex($1,/[-+][prism]/S)) { mode $chan $1 }
also you dont need the /\'s like in /mode and /k etc
keep it up ;)