Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: RyDeOrDiE1190 on July 05, 2004, 08:22 PM

Title: [VB6] Cuphead Errors
Post by: RyDeOrDiE1190 on July 05, 2004, 08:22 PM
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.
Title: Re:[VB6] Cuphead Errors
Post by: Dyndrilliac on July 05, 2004, 08:25 PM
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.
Title: Re:[VB6] Cuphead Errors
Post by: muert0 on July 05, 2004, 08:26 PM
'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
Title: Re:[VB6] Cuphead Errors
Post by: RyDeOrDiE1190 on July 05, 2004, 08:31 PM
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
Title: Re:[VB6] Cuphead Errors
Post by: Dyndrilliac on July 05, 2004, 09:07 PM
If GetStuff(...) = vbNullString Then
Title: Re:[VB6] Cuphead Errors
Post by: RyDeOrDiE1190 on July 05, 2004, 10:29 PM
o yeah, im so dumb  ;D thanks alot dude.