rendered paste bodyon 1:text:!thelp*:#:{
msg $nick number sides division multiplication addition/subtraction multiplication division
msg $nick scripted mostly by Teraunce with help from NeonDragon
}
on 1:text:!cr*:#:{
if (($2 !isnum) || ($3 !isnum) || ($4 !isnum) || ($5 !isnum) || ($6 !isnum) || ($7 !isnum) || ($8 !isnum)) {
;msg $chan replacing invalid values and calculating
}
else {
;msg $chan calculating
}
if (($2 == $null) || ($2 <= 0) || ($2 !isnum)) {
;msg $chan How many dice? Let's try 1.
var %dice=1
;halt
}
else {
var %dice = $2
%dice=$abs(%dice)
}
while (%dice>10000) {
%dice=%dice-10
msg $nick -10 dice
}
if (($3 == $null) || ($3 <= 0) || ($3 !isnum)) {
;msg $chan Let's settle for 20 sides
%sides = 20
}
else {
%sides = $3
%sides = $abs(%sides)
}
if (($4 == $null) || ($4 <= 0) || ($4 !isnum)) {
%div1 = 1
}
else {
%div1 = $4
%div1 = $abs(%div1)
}
if (($5 == $null) || ($5 <= 0) || ($5 !isnum)) {
%mul1 = 1
}
else {
%mul1 = $5
%mul1 = $abs(%mul1)
}
if (($6 == $null) || ($6 !isnum)) {
%add = 0
}
else {
%add = $6
%add = $abs(%add)
}
if (($7 == $null) || ($7 <= 0) || ($7 !isnum)) {
%div2 = 1
}
else {
%div2 = $7
%div2 = $abs(%div2)
}
if (($8 == $null) || ($8 <= 0) || ($8 !isnum)) {
%mul2 = 1
}
else {
%mul2 = $8
%mul2 = $abs(%mul2)
}
var %i = 1, %result = 0
while (%i <= %dice) {
%i = %i + 1
%result = %result + $rand(1,%sides)
}
%result2 = $calc((((( %result / %div1 ) * %mul1 ) + %add ) / %div2 ) * %mul2 )
msg $chan $nick $+ 's roll ( $+ $+(%dice,d,%sides,+,%add) $+ ) $+ : %result2 $9- (unmodified roll was %result $+ )
}
on 1:text:!troll*:#:{
if (($2 == $null) || ($2 <= 0) || ($2 !isnum)) {
;msg $chan How many dice? Let's try 1.
var %dice=1
;halt
}
else {
var %dice = $2
%dice=$abs(%dice)
}
while (%dice>10000) {
%dice=%dice-10
msg $nick -10 dice
}
if (($3 == $null) || ($3 <= 0) || ($3 !isnum)) {
;msg $chan Let's settle for 20 sides
%sides = 20
}
else {
%sides = $3
%sides = $abs(%sides)
}
if (($4 == $null) || ($4 !isnum)) {
%add = 0
}
else {
%add = $4
%add = $abs(%add)
}
var %i = 1, %result = 0
while (%i <= %dice) {
%i = %i + 1
%result = %result + $rand(1,%sides)
}
var %result2=0
%result2=%result+%add
msg $chan $nick $+ 's roll ( $+ $+(%dice,d,%sides,+,%add) $+ ) $+ : %result2 $5- (unmodified roll was %result $+ )
}
}