on *:text:!roll *:#: {
; $2 should be the format of 2d6. If you want another format, this can easily be adjusted.
var %numdice = $gettok($2-,1,100), %dicesides = $gettok($2-,2,100)
if (%numdice !isnum || %dicesides !isnum) { msg $chan ERROR: Wrong format. Example: !roll 3d6 }
while (%numdice) {
var %rolls = %rolls $rand(1,%dicesides)
dec %numdice
}
msg $chan %rolls
}