Why use a while loop, when $str() can be used?
on *:text:!roll *:#: {
tokenize 32 $lower($2-)
if (!$regex($1-,^(\d+)\x20?d\x20?(\d+)$)) {
msg $chan ERROR: Wrong format. Example: !roll 3d6
}
else {
msg $chan $calc($($str($!r(1,$regml(2)) + $chr(32),$regml(1)),2))
}
}
...maybe I am just showing off :\
though this would limit the amount of rolls able to be preformed b/c of mIRC's line-to-long thing