Just a quick hint: You can DRASTICALLY improve speed in the event by setting a variable to common used identifiers that don't require dynamic-values. ie: $chan will always be $chan, as well as $1 and $2.
At the beginning of the event, try setting a temporary variable to the commonly used identifiers. ie:
var %1 = $1, %2 = $2, %3 = $3, %c = $chan