I don't understand where/how the bot is supposed to use the success/botches/failures. If you explain a bit more, we may be able to help you...Also, explain how you would want the default difficulty level to change.

In reply to c0ldfusi0n, you would need to use ether unset %result at the end or use var %result = %result $rand(1, %dx) in the code, otherwise it would keep adding up the scores!!!
Also, ther'es no chekcing to ensure $1 is in the format <num>d<num> (e.g. 5d20)

The following scripts go in the remotes section...

You could always use /roll 5 d20 (based on c0ldfusi0n's script):

Code:
alias roll {
  [color:green];Line below checks to see if two items have been entered (e.g. /roll 5 d10). If not, stops.[/color]
  if (($1 !isnum) || (d* !iswm $2)) { echo -s * Incorrect syntax /roll. (/roll &lt;num&gt; d&lt;num&gt;) e.g. /roll 5 d10 | halt }
  [color:green];Sets %Roll.NumberOfDice to the number of dice to roll[/color]
  var %Roll.NumberOfDice = $1
  [color:green];Sets %Roll.DiceNumbers to the number in d&lt;num&gt;[/color]
  var %Roll.DiceNumbers = $right($2,-1)
  [color:green];echos to the screen what is being rolled.[/color]
  echo -a * Rolling $+(%Roll.NumberOfDice,d,%Roll.DiceNumbers)
  var %i = 1
  [color:green];Selects the random numbers[/color]
  while (%i &lt;= %Roll.NumberOfDice) {
    var %Roll.Result = %Roll.Result $rand(1,%Roll.DiceNumbers)
    inc %i
  }
  [color:green];Echos to the screen all the roll results and gives a total[/color]
  echo -a * Dice results: %Roll.Result (Total of $calc($replace(%Roll.Result,$chr(32),+)) $+ )
}


I think you may be wanting someone in a channel to type the prompt and the bot will reply in the channel.
If this is the case, then you will need to have the above in an on TEXT event:

Code:
on *:TEXT:*:[color:red]#YourChannel[/color]:{
  if (($1 == $+(!,$me)) &amp;&amp; ($2 == roll)) {
    if ($3 == help) {
      msg $chan 13* DiceRoller : Syntax - $+(!,$me) roll &lt;number_of_dice_to_roll&gt; d&lt;number_of_spots_on_dice&gt;
      msg $chan 13* DiceRoller : e.g. $+(!,$me) roll 5 d10
      msg $chan 13* DiceRoller : for help, type: $+(!,$me) roll help
      halt
    }
    if (($3 !isnum) || (d* !iswm $4)) { msg $chan 13* DiceRoller : Incorrect syntax !roll. (!roll &lt;num&gt; d&lt;num&gt;) | halt }
    var %Roll.NumberOfDice = $3
    var %Roll.DiceNumbers = $right($4,-1)
    msg $chan * Rolling $+(%Roll.NumberOfDice,d,%Roll.DiceNumbers)
    var %i = 1
    while (%i &lt;= %Roll.NumberOfDice) {
      var %Roll.Result = %Roll.Result $rand(1,%Roll.DiceNumbers)
      inc %i
    }
    msg $chan 13* DiceRoller : Results: %Roll.Result (Total of $calc($replace(%Roll.Result,$chr(32),+)) $+ )
  }
}


Hope they help ( I haven't tested them) smile

Last edited by Aubs; 03/04/03 12:21 PM.

Aubs.
cool