I'm having some trouble using variables which contain channel names. I need to be able to turn the bot on or off, at will, on a per channel basis.

The on and off triggers are working, but could someone please explain what is the proper way to check for the %#channeloff in the on text *example*

Thank you!!

Code:
ON *:TEXT:!off*:*: { 
  if ($nick isop $chan) {
    set % $+ $chan $+ off
  }
}
ON *:TEXT:!on*:*: { 
  if ($nick isop $chan) {
    unset % $+ $chan $+ off
  }
}
on !*:TEXT:*example*:#: {
  if ($nick !isop $chan) { 
    if (!% $+ $chan $+ off) {
    ban $($+(-ku,1800)) $chan $nick 3 banned!
    }
  }
}