'Params: <no parameters>
Dim FirstWord
Dim Multi
dim TextNow
dim BaseNum
dim BaseValue
dim TextToSend
dim Twips
dim BaseNumCount
dim Multicount
Twips = 0
Multi = Null
FirstWord = StrUtils.NParam(1, Msg) 'extract first string
if strutils.CharCount(FirstWord, "d") = 1 then 'check that it contains 1 d
Multi = 1
if strutils.CharCount(FirstWord, "x") = 1 then 'check thatit contains 1 x
TextNow = strutils.leftstr(FirstWord, strutils.pos("x",FirstWord,1)-1) 'extract Multi
if strutils.isnumeric(TextNow) then 'check that multi is numeric
if Textnow > 100 then 'check if we break the dice number's limit
Multi = 100
elseif TextNow < 1 then 'check if the dice number is less then one.
Multi = 1
else
Multi = TextNow
end if 'end of the value check
end if 'end of the IsNumeric check
FirstWord = StrUtils.DeleteLeft(FirstWord, 1, strutils.CharCount(FirstWord, "x")+1) 'Ensure that FirstWord is stripped of the Multiplier Values.
end if 'end of the x check
TextNow = strutils.leftstr(FirstWord, strutils.pos("d",FirstWord,1)-1) 'extract Number
if strutils.isnumeric(TextNow) then 'check that Number is numeric
if Textnow > 100 then 'check if we break the dice number's limit
BaseNum = 100
elseif TextNow < 1 then 'check if the dice number is less then one.
BaseNum = 1
else
BaseNum = TextNow
end if 'end of the value check
end if 'end of the IsNumeric check
if BaseNum = "" or BaseNum = Null then
Exit sub
end if
FirstWord = StrUtils.DeleteLeft(FirstWord, 1, strutils.CharCount(FirstWord, "d")+1)
channel.command "say First:" & FIrstWord
if strutils.CharCount(FirstWord, "+") = 1 then
TextNow = strutils.leftstr(FirstWord, strutils.pos("+",FirstWord, 1)-1)
If strutils.isnumeric(TextNow) then
BaseValue = TextNow
End if
if BaseValue > 9 then
Twips = StrUtils.DeleteLeft(FirstWord, 1, strutils.CharCount(FirstWord, "+")+3)
else
Twips = StrUtils.DeleteLeft(FirstWord, 1, strutils.CharCount(FirstWord, "+")+1)
end if
elseif strutils.Charcount(FirstWord, "-") = 1 then
TextNow = strutils.leftstr(FirstWord, strutils.pos("-",FirstWord, 1)-1)
If strutils.isnumeric(TextNow) then
BaseValue = TextNow
End if
if BaseValue > 9 then
Twips = "-" & StrUtils.DeleteLeft(FirstWord, 1, strutils.CharCount(FirstWord, "-")+3)
else
Twips = "-" & StrUtils.DeleteLeft(FirstWord, 1, strutils.CharCount(FirstWord, "-")+1)
End If
else
BaseValue = FirstWord
end if
channel.command "say " & Twips & ":" & FirstWord & ":" & strutils.pos("+",FirstWord, 1) & ":" & BaseValue
BaseNum = int(BaseNum)
Multi = int(Multi)
MultiCount = 0
TextTosend = ""
if Multi > 1 then
do while MultiCount < Multi
MultiCount = MultiCount + 1
TextToSend = TextToSend & "[ "
if BaseNum = 1 then
Randomized = int(BaseValue * rnd())
TextToSend = TextToSend & Randomized & "(" & Randomized + Twips & ") "
else
BaseNumCount = 0
do while BaseNumCount < BaseNum
BaseNumCount = BaseNumCount + 1
Randomized = int(BaseValue * rnd())
TextToSend = TextToSend & Randomized & "(" & Randomized + Twips & ") "
Loop
end if
TextToSend = TextToSend & " ] "
Loop
else
if BaseNum = 1 then
Randomized = int(BaseValue * rnd())
TextToSend = TextToSend & Randomized & "(" & int(Randomized + Twips) & ") "
else
BaseNumCount = 0
do while BaseNumCount < BaseNum
BaseNumCount = BaseNumCount + 1
Randomized = int(BaseValue * rnd())
TextToSend = TextToSend & Randomized & "(" & int(Randomized + Twips) & ") "
Loop
end if
end if
channel.command "say Multi: " & Multi & "BaseNum: " & BaseNum
channel.command "say <" & sender.nick & "> rolled " & Multi & "x" & BaseNum & "d" & BaseValue & ": " & TextToSend
end if 'end of the D check