on 42:text:!gow:#: {
if (!%floodsave) set %floodsave 0
if (%floodsave = 0) {
set %floodsave 1
set %rollsper 0
msg $chan Open for teh Business!
//timer1 0 4 set %rollsper 0
}
else {
//timer1 off
set %floodsave 0
set %rollsper 10
msg $chan Teh shop be closed.
}
}
on 5:text:!roll*:#: {
if (%rollsper < 2) {
inc %rollsper 1
set %total 0
if ($regex(rollwhat,$2,/^(\d+)d(\d+)$/)) {
set %rolltype 1
rollem
}
else if ($regex(rollwhat,$2,/^(\d+)d(\d+)\+(\d+)$/)) {
set %rolltype 2
rollem
}
else if ($regex(rollwhat,$2,/^(\d+)d(\d+)\-(\d+)$/)) {
set %rolltype 3
rollem
}
else {
msg $chan Roll who with the what now?
}
}
}
alias rollem {
set %nod $regml(rollwhat,1)
if (%nod > 999) set %nod 1
set %sod $regml(rollwhat,2)
if (%sod > 999) set %sod 20
set %mod $regml(rollwhat,3)
if (%mod > 999) set %mod 0
if (%nod = 1) && (%sod = 20) {
set %ifcrit $rand(1,20)
if (%ifcrit = 20) msg $chan Thar's a critter!
set %total %ifcrit
}
else {
while (%nod > 0) {
inc %total $rand(1,%sod)
dec %nod 1
}
}
if (%rolltype = 2) inc %total %mod
else if (%rolltype = 3) dec %total %mod
msg $chan You rolled %total $+ , scalawag.
}