There already exists the on RAWMODE event and $mode identifier. Perhaps the latter should be extended to work for all mode chars which take a parameter.

Until then you can use starbucks_mafia's solution.