• Welcome to Valhalla Legends Archive.
 

[VB6] Cuphead Errors

Started by RyDeOrDiE1190, July 05, 2004, 08:22 PM

Previous topic - Next topic

RyDeOrDiE1190

Hey guys, I'm having a little trouble with my vb bot. Here is the code:
'ver
If Message = ".ver" And GetStuff("access", Username, App.Path & "\users.ini") >= 10 Then
CleanSlateBot1.Send "ÁQ.:ÁRaÁPKÁRaÁQ)ÁYOpZÁQ(:.  ÁQ:.ÁRBy aKa.OpTiXÁQ:.  .:Version " & App.Major & "." & App.Minor & ":."
End If
'say
Dim cmdSay As String, X As String
cmdSay = Message
If InStr(1, cmdSay, ".say", vbBinaryCompare) And GetStuff("access", Username, App.Path & "\users.ini") >= 10 Then
X = Replace(cmdSay, ".say", "")
CleanSlateBot1.Send X
End If
'home
If Message = ".home" And GetStuff("access", Username, App.Path & "\users.ini") >= 30 Then
CleanSlateBot1.Send "/join clan aka"
End If
'time
If Message = ".time" And GetStuff("access", Username, App.Path & "\users.ini") >= 0 Then
CleanSlateBot1.Send "ÁYThe time is " & Time & " On " & Date
End If
'ban
If InStr(1, cmdSay, ".ban", vbBinaryCompare) And GetStuff("access", Username, App.Path & "\users.ini") >= 80 Then
X = Replace(cmdSay, ".ban", "")
CleanSlateBot1.Send "/ban " & X
End If
'kick
If InStr(1, cmdSay, ".kick", vbBinaryCompare) And GetStuff("access", Username, App.Path & "\users.ini") >= 40 Then
X = Replace(cmdSay, ".kick", "")
CleanSlateBot1.Send "/kick " & X
End If
'des
If InStr(1, cmdSay, ".des", vbBinaryCompare) And GetStuff("access", Username, App.Path & "\users.ini") >= 80 Then
X = Replace(cmdSay, ".des", "")
CleanSlateBot1.Send "/designate " & X
CleanSlateBot1.Send "ÁYUser " & X & " designated"
Pause 1.9
End If

This code occurs when a message is sent to the chatroom.


I get a runtime error 13, a type mismatch, everytime someone talks. Its strange though, because it only seems to happen when there is a group of users larger then 3.

Dyndrilliac

#1
Put it in code tags please.

Edit: Also, it would probably easier, and more efficient to use Select Case in this situation instead of several If statements.
Quote from: Edsger W. DijkstraIt is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.

muert0

'ver
If Message = ".ver" And GetStuff("access", Username, App.Path & "\users.ini") >= 10 Then
CleanSlateBot1.Send "ÁQ.:ÁRaÁPKÁRaÁQ)ÁYOpZÁQ(:.  ÁQ:.ÁRBy aKa.OpTiXÁQ:.  .:Version " & App.Major & "." & App.Minor & ":."
End If
'say
Dim cmdSay As String, X As String
cmdSay = Message
If InStr(1, cmdSay, ".say", vbBinaryCompare) And GetStuff("access", Username, App.Path & "\users.ini") >= 10 Then
X = Replace(cmdSay, ".say", "")
CleanSlateBot1.Send X
End If
'home
If Message = ".home" And GetStuff("access", Username, App.Path & "\users.ini") >= 30 Then
CleanSlateBot1.Send "/join clan aka"
End If
'time
If Message = ".time" And GetStuff("access", Username, App.Path & "\users.ini") >= 0 Then
CleanSlateBot1.Send "ÁYThe time is " & Time & " On " & Date
End If
'ban
If InStr(1, cmdSay, ".ban", vbBinaryCompare) And GetStuff("access", Username, App.Path & "\users.ini") >= 80 Then
X = Replace(cmdSay, ".ban", "")
CleanSlateBot1.Send "/ban " & X
End If
'kick
If InStr(1, cmdSay, ".kick", vbBinaryCompare) And GetStuff("access", Username, App.Path & "\users.ini") >= 40 Then
X = Replace(cmdSay, ".kick", "")
CleanSlateBot1.Send "/kick " & X
End If
'des
If InStr(1, cmdSay, ".des", vbBinaryCompare) And GetStuff("access", Username, App.Path & "\users.ini") >= 80 Then
X = Replace(cmdSay, ".des", "")
CleanSlateBot1.Send "/designate " & X
CleanSlateBot1.Send "ÁYUser " & X & " designated"
Pause 1.9
End If
To lazy for slackware.

RyDeOrDiE1190

ok guys I figured it out, IM SO DUMB! First of all, I definitely should have used Select Case, but what was giving me errors, was that the names that were talking weren't on the INI, so when VB looked up the names, it got an error. Anybody got a function to verify if the ini key actually exists?
something like
CheckINI(app$, key$, filename$) as boolean

Dyndrilliac

#4
If GetStuff(...) = vbNullString Then
Quote from: Edsger W. DijkstraIt is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.

RyDeOrDiE1190

o yeah, im so dumb  ;D thanks alot dude.