$mid($gettok($chan(#).mode,1,32),2) perhaps? Not sure if I understood the question or not, but I think that's it.