Here's a basic die roller that accepts any sided dice and any number of dice:

Code:
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
}


Example Uses:
!roll 3d6
!roll 2d12
!roll 4 d 5

Last edited by Riamus2; 28/07/10 11:41 PM.

Invision Support
#Invision on irc.irchighway.net