Includes dice rolling with a sort of regular system (!roll X Y, where X is the number of dice and Y is the number of sides) and the world of darkness system (!wod numberofdice difficulty). The world of darkness system includes automatic rerolls!
Also includes coin flipping, a rudimentary calculator, and automatic stat generation for D&D using the "4d6, drop lowest" method. Falerin's RPGServ calls it ASCORES V.
This is turning into a substitute for RPGServ. I'm not sure whether to be happy or sad about that.
Bug fix II: mIRC will no longer crash when yet another ass uses !wod x y, where x and y are anything other than numbers.
;This is turning into an RPGServ substitute.
;The file will probably be renamed eventually
; SYNTAX: !FLIPCOIN
; Flips a coin
; $iif syntax: test, true, false.
on *:TEXT:!flipcoin:#:{
var %rand = $rand(1,2)
msg $chan The coin flip was: $iif(%rand == 1, Heads, $iif(%rand == 2, Tails, For some reason this coin landed on its edge $&
and refuses to fall over. Pick it up and flip it again if you want a result)) $+ .
}
; SYNTAX: !ROLL X Y DESCRIPTION
; X is number of dice and Y is number of sides
; Description is optional
on *:TEXT:!roll *:#:{
if (($$2 !isnum 1-100) || ($$3 !isnum 1-100)) {
msg $chan Roll with numbers, not letters.
halt
}
set %NumberOfDice $$2
set %NumberOfSides $$3
set %temp 0
set %DiceRolled 0
set %rand 0
set %results 0
set %results2 0
while ( %DiceRolled < %NumberOfDice ) {
set %rand $rand(1,%NumberOfSides)
set %temp %results2
set %results2 $calc(%temp + %rand)
if (%results == 0) { set %results %rand }
else {
set %temp %results
set %results %temp %rand
}
inc %DiceRolled
}
msg $chan Results for $nick $+ : $3-
msg $chan %results
msg $chan Total dice: %NumberOfDice $+ . Number of sides: %NumberOfSides $+ . Total of dice rolled: %results2 $+ .
unset %NumberOfDice %NumberOfSides %temp %DiceRolled %rand %results %results2
}
; SYNTAX: !WOD NUMBER_OF_DICE DIFFICULTY [DESCRIPTION]
; For use with the World of Darkness dice system. Description is optional.
on *:TEXT:!wod *:#:{
if (($$2 !isnum) || ($$3 !isnum)) {
msg $chan $nick $+ : Stop trying to break me.
}
else {
set %NumberOfDice $$2
set %difficulty $$3
set %temp 0
set %botches 0
set %successes 0
set %DiceRolled 0
set %rand 0
set %results 0
set %rerolls 0
while ( %DiceRolled < %NumberOfDice ) {
set %rand $rand(1,10)
if (%results == 0) { set %results %rand }
else {
set %temp %results
set %results %temp %rand
}
if (%rand == 1) inc %botches
else if (%rand >= %difficulty) inc %successes
if (%rand == 10) inc %rerolls
inc %DiceRolled
}
set %total $calc(%successes - %botches)
msg $chan Results for $nick $+ : $4-
msg $chan %results
msg $chan Total dice: %NumberOfDice $+ . Difficulty: %difficulty $+ . Successes: %successes $+ . Botches: %botches $+ . Total: %total $+ .
set %rerolled 0
set %results 0
while (%rerolled < %rerolls) {
set %rand $rand(1,10)
if (%results == 0) { set %results %rand }
else {
set %temp %results
set %results %temp %rand
}
if (%rand == 1) inc %botches
else if (%rand >= %difficulty) inc %successes
inc %rerolled
}
if (%rerolls > 0) {
set %total $calc(%successes - %botches)
msg $chan Reroll results for specialization: %results
msg $chan New successes: %successes $+ . New botches: %botches $+ . New total: %total $+ .
}
unset %NumberOfDice %difficulty %temp %botches %successes %DiceRolled %rand %results %rerolls %total %rerolled
}
}
; Generates random stats for D&D using the "4d6, drop lowest" method.
; In Falerin's RPGServ, this would be ASCORES method 5.
on *:TEXT:!ascores:#:{
set %total 0
set %temp 0
set %stats 0
while (%stats < 6) {
set %stat1 $rand(1,6)
set %stat2 $rand(1,6)
set %stat3 $rand(1,6)
set %stat4 $rand(1,6)
; Find lowest number
set %lowest %stat1
if (%stat2 < %lowest) set %lowest %stat2
if (%stat3 < %lowest) set %lowest %stat3
if (%stat4 < %lowest) set %lowest %stat4
if (%total == 0) set %total $calc(%stat1 + %stat2 + %stat3 + %stat4 - %lowest)
else {
set %temp %total
set %total %temp $calc(%stat1 + %stat2 + %stat3 + %stat4 - %lowest)
}
inc %stats
}
msg $chan Ascores for $nick $+ : %total
unset %total %temp %stats %stat1 %stat2 %stat3 %stat4 %lowest
}
; SYNTAX: !calc calculation
; operators must be separated by spaces
on *:TEXT:!calc *:#:{
var %input $$2-
var %output $calc($$2-)
msg $chan Calculation for $nick $+ : %output
}