I realize $nick and $chan respectively collapse when used outside the native event, but what I was getting at is that he abuses global variables for no reason.
sockwrite -n $sockname GET %url HTTP/1.1
and
if ($regex(%mstats,%reg)) {
These are the only instances of the two variables and would function perfectly if the contents of these variables simply replace rather than circumvent the data that belongs there.