- on *:TEXT:Roll *:*:{
- if ($2 isalpha) halt
- if (-showface isin $2-) || (showface isin $2-) || (-SF isin $2-) { var %showface yes }
- if (d isin $2) { }
- else { halt }
- if (. isin $2) halt
- if (, isin $2) halt
- if (~ isin $2) halt
- if (! isin $2) halt
- if (? isin $2) halt
- if ($pos($2,d,1) == 1) { var %prestring $chr(58) $+ $replacex($replacex($replacex($replacex($replacex($replacex($replacex($replacex($replacex($2,+,:+:),-,:-:),*,:*:),/,:/:),&,:&:),$chr(40),: $+ $chr(40) $+ :),$chr(41),: $+ $chr(41) $+ :),$chr(35),#:),$chr(68),$chr(100)) }
- else { var %prestring $replacex($replacex($replacex($replacex($replacex($replacex($replacex($replacex($replacex($2,+,:+:),-,:-:),*,:*:),/,:/:),&,:&:),$chr(40),: $+ $chr(40) $+ :),$chr(41),: $+ $chr(41) $+ :),$chr(35),#:),$chr(68),$chr(100)) }
- if ($3 = target) || ($3 = TN) var %success 0
- var %string $replacex(%prestring,:d,:1d)
- var %stringfetch $matchtok(%string,d,0,58)
- var %stringfetch2 $matchtok(%string,d,0,58)
- var %ismath $calc($matchtok(%string,$chr(43),0,58) + $matchtok(%string,$chr(45),0,58) + $matchtok(%string,$chr(42),0,58) + $matchtok(%string,$chr(47),0,58) )
- var %instancefetch $numtok(%string,38)
- ;Monster argument for rolls with math
- if ($matchtok(%string,$chr(35),0,58) == 0) && (%ismath > 0) {
- if (%stringfetch > 10) {
- msg $chan 6 $+ $read(tsunmisc.txt,3)
- halt
- }
- if (%instancefetch <= 0) { var %instancefetch 1 }
- while (%stringfetch > 0) {
- var %diceresult
- var %diceset $matchtok(%string,d,%stringfetch,58)
- var %diceroll $gettok(%diceset,1,100)
- if (%diceroll > 50) {
- msg $chan 6 $+ $read(tsunmisc.txt,4)
- halt
- }
- if ($gettok(%diceset,2,100) > 100) {
- msg $chan 6 $+ $read(tsunmisc.txt,5)
- halt
- }
- while (%diceroll > 0) {
- var %diceresult $instok(%diceresult,$rand(1,$gettok(%diceset,2,100)),0,43)
- dec %diceroll 1
- }
- var %dicemath $instok(%dicemath,$calc( %diceresult ),-500,58)
- dec %stringfetch 1
- }
- var %rebuild1 $reptok(%string,$matchtok(%string,d,1,58),$gettok(%dicemath,1,58),1,58)
- var %rebuild2 $reptok(%rebuild1,$matchtok(%rebuild1,d,1,58),$gettok(%dicemath,2,58),1,58)
- var %rebuild3 $reptok(%rebuild2,$matchtok(%rebuild2,d,1,58),$gettok(%dicemath,3,58),1,58)
- var %rebuild4 $reptok(%rebuild3,$matchtok(%rebuild3,d,1,58),$gettok(%dicemath,4,58),1,58)
- var %rebuild5 $reptok(%rebuild4,$matchtok(%rebuild4,d,1,58),$gettok(%dicemath,5,58),1,58)
- var %rebuild6 $reptok(%rebuild5,$matchtok(%rebuild5,d,1,58),$gettok(%dicemath,6,58),1,58)
- var %rebuild7 $reptok(%rebuild6,$matchtok(%rebuild6,d,1,58),$gettok(%dicemath,7,58),1,58)
- var %rebuild8 $reptok(%rebuild7,$matchtok(%rebuild7,d,1,58),$gettok(%dicemath,8,58),1,58)
- var %rebuild9 $reptok(%rebuild8,$matchtok(%rebuild8,d,1,58),$gettok(%dicemath,9,58),1,58)
- var %rebuild10 $reptok(%rebuild9,$matchtok(%rebuild9,d,1,58),$gettok(%dicemath,10,58),1,58)
- if (%stringfetch2 == 1) var %rebuild %rebuild1
- if (%stringfetch2 == 2) var %rebuild %rebuild2
- if (%stringfetch2 == 3) var %rebuild %rebuild3
- if (%stringfetch2 == 4) var %rebuild %rebuild4
- if (%stringfetch2 == 5) var %rebuild %rebuild5
- if (%stringfetch2 == 6) var %rebuild %rebuild6
- if (%stringfetch2 == 7) var %rebuild %rebuild7
- if (%stringfetch2 == 8) var %rebuild %rebuild8
- if (%stringfetch2 == 9) var %rebuild %rebuild9
- if (%stringfetch2 == 10) var %rebuild %rebuild10
- while (%instancefetch > 0) {
- var %preresult $instok(%preresult,$floor($calc($replacex($gettok(%rebuild,%instancefetch,38),:,))),-500,150)
- dec %instancefetch 1
- }
- var %result $replacex(%preresult,$chr(150),$chr(32) $+ and $+ $chr(32))
- msg $chan $nick rolled %result $chr(91) $+ $replacex(%rebuild,:,) $+ $chr(93) -6 $read(tsundice.txt)
- }
- Then the for exalted rolls: multiple instance rolls:
- if ($matchtok(%string,$chr(35),0,58) > 0) {
- if (%instancefetch > 1) {
- msg $chan 6 $+ $read(tsunmisc.txt,6)
- halt
- }
- if (%stringfetch > 1) {
- msg $chan 6 $+ $read(tsunmisc.txt,7)
- halt
- }
- var %instances $replacex($gettok(%string,1,58),$chr(35),)
- if (%instances > 50) {
- msg $chan 6 $+ $read(tsunmisc.txt,8)
- halt
- }
- var %newstring $deltok(%string,1,58)
- while (%instances > 0) {
- var %diceresult
- var %diceset $matchtok(%newstring,d,1,58)
- var %diceroll $gettok(%diceset,1,100)
- if (%diceroll > 50) {
- msg $chan 6 $+ $read(tsunmisc.txt,4)
- halt
- }
- if ($gettok(%diceset,2,100) > 100) {
- msg $chan 6 $+ $read(tsunmisc.txt,5)
- halt
- }
- while (%diceroll > 0) {
- var %diceresult $instok(%diceresult,$rand(1,$gettok(%diceset,2,100)),1,43)
- dec %diceroll 1
- }
- if ($left($4,1) != $chr(47)) && ($floor($calc($replacex($reptok(%newstring,$matchtok(%string,d,1,58),$calc( %diceresult ),1,58),:,))) >= $4) { inc %success 1 }
- if ($left($4,1) == $chr(47)) { inc %success $floor($calc($floor($calc($replacex($reptok(%newstring,$matchtok(%string,d,1,58),$calc( %diceresult ),1,58),:,))) $4)) }
- if ($5 = double) && ($floor($calc($replacex($reptok(%newstring,$matchtok(%string,d,1,58),$calc( %diceresult ),1,58),:,))) == $6) { inc %success 1 }
- var %result $instok(%result,$floor($calc($replacex($reptok(%newstring,$matchtok(%string,d,1,58),$calc( %diceresult ),1,58),:,))),0,44)
- dec %instances 1
- }
- if ($3 == target) || ($3 == TN) { msg $chan $nick rolled %result with %success successes. -6 $read(tsundice.txt) }
- else { msg $chan $nick rolled %result -6 $read(tsundice.txt) }
- }
- }
