Sub ONTEXT(Message,Channel,Nickname,Host,ServerNumber) words = split(Message," ") if words(0) = "!dice" and ubound(words) = 2 then if IsNumeric(words(1)) and IsNumeric(words(2)) then 'words(1) - how many times dice is rolled 'words(2) - how many sides to the dice '!dice 3 6 <- rolls a 6-sided die 3 times 'check that no more then 10 rolls is asked, and limit to 10 if words(1) > 10 then words(1) = 10 'SendCommand "/msg " & Channel & " I should roll a " & words(2) & " -sided dice " & words(1) & " times",ServerNumber Randomize for i = 1 to words(1) 'get the random value here dieValue=int(rnd * words(2)) + 1 SendCommand "/msg " & Channel & " " & NickName & " rolled " & words(2) & "-sided die number " & i & " of " & words(1) & " : " & dieValue, ServerNumber next end if end if End Sub Function OUTTEXT(OutgoingText) words=split(OutGoingText) if words(0) = "!dice" and ubound(words) = 2 then 'check if in a channel if GetIdentifier("$activetype") = 2 then if IsNumeric(words(1)) and IsNumeric(words(2)) then 'words(1) - how many times dice is rolled 'words(2) - how many sides to the dice '!dice 3 6 <- rolls a 6-sided die 3 times 'check that no more then 10 rolls is asked, and limit to 10 if words(1) > 10 then words(1) = 10 Randomize for i = 1 to words(1) 'get the random value here dieValue=int(rnd * words(2)) + 1 SendCommand "/msg $active $me rolled " & words(2) & "-sided die number " & i & " of " & words(1) & " : " & dieValue next end if end if end if OutText=OutGoingText End Function