I keep getting a Run-time Error 13: "Type Mismatch" on one of the below lines of code.
My input is:
":[email protected] PRIVMSG #shadowfall :!roll 1"
VB Code:
Select Case True 'Does input meet requirements for Case Case InStr(sockBuff, "!roll") <> 0: 'Digging out the "!roll" command charLocNum = InStr(2, sockBuff, ":") comFinder = Right(sockBuff, Len(sockBuff) - charLocNum) 'Digging out name of inputter 'Can use a Mid() command below, but didn't know that at the time charName = Left(sockBuff, InStr(1, sockBuff, "!") - 1) charName = Right(charName, Len(charName) - 1) 'Making sure "!roll" is at start of input If InStr(comFinder, "!roll") = 1 Then 'If it's single/double digit dice with NO threshold... If Len(comFinder) = 7 Or 8 Then 'Digging out number of dice numFinder = InStr(comFinder, " ") fstNum = Right(comFinder, Len(comFinder) - numFinder) 'The below line of code contains the error. i know the first part of it is correct (It runs great lower in the code) sendToIRC (sendMsgText + " PRIVMSG #shadowfall :" + charName + " rolled " + fstNum + " dice: " + diceRoller(fstNum, 0)) 'else if Len(CommandFinder) = 9 or 10 or 11 ' Find first " " ' Find 2nd " " ' Grab 1st number ' Grab 2nd number ' Call roll program - send First num as dice, Second num as Threshold (Target #) End If If InStr(1, comFinder, "!roll") = 1 Then charName = Left(sockBuff, InStr(1, sockBuff, "!") - 1) charName = Right(charName, Len(charName) - 1) 'The below line of code works perfect sendToIRC (sendMsgText + " PRIVMSG #shadowfall :" + charName) End If End If End Select
The function it's calling is:
VB Code:
Function diceRoller(ByVal fstNum As Long, ByVal sndNum As Long) As String 'Haven't yet programmed in the random number calculations yet diceRoller = "A GODLY DICE ROLL!" End Function
If anything needs explanation, please let me know.I cannot figure out what it is I'm doing wrong in the indicated line of code.
Thank you!




I cannot figure out what it is I'm doing wrong in the indicated line of code.
Reply With Quote