If you are gonna do it that way to individualize the text event by inserting an exclamation mark, you could still do it like so:
on *:TEXT:!*:#: {
if ($1 == !quote) {
without using the $right(). I'd recommend you add a
tokenize 32 $strip($1-)
under the text event so the control codes get stripped out, as well as a basic trigger flood control.