Ok, so I modified it slightly to prevent more than 30 dice, but what I'm now trying (unsucessfully) to do is to get it to generate the roll, and then count how many 10's are rolled, and automatically reroll that many dice.
Eg if the roll comes up:
8, 4, 9, 9, 1, 2, 10, 3, 6, 6, 3, 9, 4, 10, 3, 3, 6, 4, 5, 6
then it must see that there are two tens and reroll two dice.
It needs to do this again and again, until no more 10's come up in the roll, so if in the above example the reroll came up:
10, 10
it would reroll two dice, and if they came up:
10, 8
then it would reroll one dice, and if that came up:
10
then it would reroll again, and so on until there are no more tens. THEN it needs to:
msg $chan No more rerolls
If possible it should keep track of all successes (8,9,10) throughout and then display a message Sucesses: X, whre X is the number of successes rolled, once all rerolls are done.
Is this even possible?
on *:text:roll &:#: {
if ($2 !isnum) { msg $chan Invalid number of dice. | return }
var %c = $2
if (%c > 30) {
msg # No way, That's too many dice!
halt
}
while (%c) {
var %roll = $rand(1,10)
if (%roll = 1) { var %roll = 00,01 $+ %roll }
elseif (%roll isnum 2-7) { var %roll = 00,01 $+ %roll }
elseif (%roll isnum 8-9) { var %roll = 11,01 $+ %roll }
else { var %roll = 09,01 $+ %roll }
var %dice = %dice $+ $iif(%dice, $+ $chr(44)) %roll
dec %c
}
msg $chan $nick rolls: $replace(%dice,$chr(46), $+ $chr(44) $+ $chr(32))
}
Assistance would be greatly valued!