Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /exroll {
- %name = $nick
- if (%name == $null) {
- %name = $me
- }
- %grammar = die
- %dice = 1
- if ((strip($$1) isnum) && ($$1 >= 1)){
- %dice = $int($$1)
- %grammar = dice
- }
- if (%dice > 50) {
- % dice = 50
- }
- %success = 0
- %counter = 1
- %success = 0
- %crits = 0
- %botches = 0
- %target = 7
- %auto = 0
- %double = 10
- %reroll = 0
- %rerollones = 0
- %rerolltriggered = 0
- %result = 0
- %readout = -
- %roll = 0
- %die
- %diestart
- %parenthetical
- %reason
- %total = 0
- %arg2 = $2
- %arg3 = $3
- %arg4 = $4
- %arg5 = $5
- %arg = %arg2
- %argsused = 0
- if ($0 < 2) {
- goto rolling
- }
- %curarg = 2
- :argchecks
- if ($left(%arg,1) == t) && ($mid(%arg,2) isnum) {
- /inc %argsused
- %target = $mid(%arg,2)
- if (%target > 10) {
- %target = 10
- }
- }
- if ($left(%arg,1) == a) && ($mid(%arg,2) isnum) {
- /inc %argsused
- %auto = $mid(%arg,2)
- }
- if ($left(%arg,1) == d) && ($mid(%arg,2) isnum) {
- /inc %argsused
- %double = $mid(%arg,2)
- if (%double < 1) {
- %double = 11
- }
- }
- if ($left(%arg,1) == r) && ($mid(%arg,2,1) isnum) && (!$regex($mid(%arg,2),[a-z || A-Z])) {
- /inc %argsused
- %reroll = $mid(%arg,2)
- if ($count(%arg,1) > $count(%arg,10)) {
- %rerollones = 1
- }
- }
- if (%curarg == 2) {
- %arg = %arg3
- %curarg = 3
- goto argchecks
- }
- if (%curarg == 3) {
- %arg = %arg4
- %curarg = 4
- goto argchecks
- }
- if (%curarg == 4) {
- %arg = %arg5
- %curarg = 5
- goto argchecks
- }
- %ticker = 2
- %rerollednumbers = 0
- while (%ticker < 11) {
- if ($count(%reroll,%ticker) > 0) {
- /inc %rerollednumbers
- }
- /inc %ticker
- }
- if (%rerollednumbers == 9) && (%rerollones == 1) {
- %rerollones = 0
- %reroll = 0
- }
- :rolling
- if (%double < %target) {
- %double = %target
- }
- while (%counter <= %dice) {
- %roll = $rand(1,10)
- if ((%roll isin %reroll) && (%roll > 1)) || (%roll == %rerollones) {
- %rerolltriggered = 1
- if (%roll < %target) {
- %die = 05 $+ %roll $+
- }
- if (%roll == 1) {
- %die = 04 $+ 1! $+
- }
- if (%roll >= %target) {
- %die = 12 $+ %roll $+
- /inc %success
- }
- if (%roll >= %double) {
- %die = 12 $+ %roll $+ 12!
- /inc %crits
- }
- %diestart = 5( $+ %die
- while ((%roll isin %reroll) && (%roll > 1)) || (%roll == %rerollones) {
- %roll = $rand(1,10)
- if ((%roll isin %reroll) && (%roll > 1)) || (%roll == %rerollones) {
- if (%roll >= %target) && (%roll < %double) {
- %diestart = %diestart $+ → $+ 12 $+ %roll $+
- /inc %success
- }
- if (%roll >= %double) {
- %diestart = %diestart $+ → $+ 12 $+ %roll $+ 12!
- /inc %crits
- /inc %success
- }
- }
- }
- }
- if (%roll < %target) {
- %die = 05 $+ %roll $+
- }
- if (%roll >= %target) {
- %die = 12 $+ %roll $+
- /inc %success
- }
- if (%roll >= %double) {
- %die = 12 $+ %roll $+ 12!
- /inc %crits
- }
- if (%roll == 1) {
- %die = 04 $+ 1! $+
- /inc %botches
- }
- :nextdie
- /inc %counter
- if (%rerolltriggered == 1) {
- %die = %diestart $+ → $+ %die $+ 5) $+
- }
- %rerolltriggered = 0
- %readout = %readout %die
- /unset %roll
- /unset %die
- }
- %total = %success + %crits
- %total = %total + %auto
- /unset %parenthetical
- /unset %reason
- if (%auto > 0) || (%double < 11) || (%reroll > 0) {
- %parenthetical = (
- }
- if (%double < 11) {
- %parenthetical = %parenthetical $+ Doubling12 %double $+ s
- }
- if (%auto > 0) {
- if (%double < 11) {
- %parenthetical = %parenthetical $+ ,
- }
- %parenthetical = %parenthetical $+ Adding12 %auto $+
- }
- if (%reroll > 0) {
- if (%auto > 0) || (%double < 11) {
- %parenthetical = %parenthetical $+ ,
- }
- %parenthetical = %parenthetical $+ Rerolling12 %reroll $+
- }
- if (%auto > 0) || (%double < 11) || (%reroll > 0) {
- %parenthetical = %parenthetical $+ )
- }
- if (%argsused == 0) && ($0 > 1) {
- %reason = to12 $2- $+
- }
- if (%argsused == 1) && ($0 > 2) {
- %reason = to12 $3- $+
- }
- if (%argsused == 2) && ($0 > 3) {
- %reason = to12 $4- $+
- }
- if (%argsused == 3) && ($0 > 4) {
- %reason = to12 $5- $+
- }
- if (%argsused == 4) && ($0 > 5) {
- %reason = to12 $6- $+
- }
- /msg $chan %name rolls $+ 12 %dice $+ %grammar at TN4 %target $+ %parenthetical %reason [Successes:12 %total $+ , Doubled:12 %crits $+ , Ones:4 %botches $+ ]
- /msg $chan %readout -
- /unsetall
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement