I've changed the $active for the ON TEXT: to $chan, forgot to do that after testing (I was only in one channel at the time).
As for the tokenizing, I'm not really sure how to implement that since it replaces $1- (in this case, the original input formula) with $1 = number of dice and $2 = sides of the polygon, and since it keeps going back to check in on the original input $1-.... Unless I made another %var of course :P I'm just feeling lethargic at the moment.
If it just went with only one XdY, it could fit it in with minimal problems, but this thing allows you to go like (4d6 + (8d12 - 4d4)) + 2 , etc. lol. I'll get around to it.