Valhalla Legends Forums Archive | Battle.net Bot Development | Channel Problems with my Bot...

AuthorMessageTime
WinSocks
yeah i ben having weird ass runtime errors as it says when i join a channel with more than 10 users in it..... i get this error sometimes when i do join the channel with more than 10 users in it.

--------------------------------------------------------
'Run-time error '5':

Invalid procedure call or argument
--------------------------------------------------------

when i select debug it sends me to this snippet of code.

[code]Private Sub sckBnet_DataArrival(ByVal bytesTotal As Long)
Dim strBuffer As String, strTemp As String, lngLen As Long
frmMain.sckBnet.GetData strTemp, vbString
strBuffer = strBuffer & strTemp
While Len(strBuffer) > 4
lngLen = Val("&H" & StrToHex(StrReverse(Mid(strBuffer, 3, 2))))
If Len(strBuffer) < lngLen Then Exit Sub
Parse (Left(strBuffer, lngLen)) <<<--------- This is the highlighted text when debugged
strBuffer = Mid(strBuffer, lngLen + 1)
Wend

End Sub
[/code]

If anyone can help me with this problem it would be greatful...
May 12, 2003, 11:39 PM
Noodlez
You're probably not getting the entire packet, so when you attempt to do Left(data,length) Left won't work.
May 12, 2003, 11:48 PM
WinSocks
is there any way to remedy this problem?
May 13, 2003, 12:07 AM
Noodlez
Compare the length of the buffer with the length the packet should be, if the length is too short, assume the next packet you will be receiving contains more (if not the rest) of your packet.
May 13, 2003, 1:16 AM
Camel
[quote author=Noodlez link=board=17;threadid=1315;start=0#msg9804 date=1052783320]
You're probably not getting the entire packet, so when you attempt to do Left(data,length) Left won't work.
[/quote]

i don't think left will ever cause a runtime error...it'll just assume you meant the entire string if you put a longer length
May 13, 2003, 1:26 AM
drivehappy
Camel, you're correct. You do get an Invalid procedure call or argument if the length is negative though.

Vial, use the Debug.Print for the length and check what the last one is on error.
May 13, 2003, 2:09 AM
WinSocks
I talked to Spht on battle.net and he told me that if i put:

[code]On Error Resume Next[/code]

it should prevent some of the erros that occur when i join a channel, it don't make the Run-time error anymore though, but the bot crashes now when i have that code in it. I need to take a break i'm wreaking my brain over it..

*Pops some Advil*
May 13, 2003, 2:19 AM
Camel
just a commment: On Error Resume Next is sort of a last ditch resort: it absolutely does not solve the problem; it simply prevents vb from reporting the error. if you want to handle the error, you might try On Error Goto <lable>
May 13, 2003, 4:23 AM
Spht
[quote author=ViaL link=board=17;threadid=1315;start=0#msg9823 date=1052792347]
I talked to Spht on battle.net and he told me that if i put:

[code]On Error Resume Next[/code]

it should prevent some of the erros that occur when i join a channel, it don't make the Run-time error anymore though, but the bot crashes now when i have that code in it. I need to take a break i'm wreaking my brain over it..

*Pops some Advil*

[/quote]

...Huh? I wasn't talking to anyone on Battle.net lately about Visual Basic, and I wouldn't suggest you to use that statement [see Camel's reply]. I believe you have me mistaken for someone else.
May 13, 2003, 6:24 PM
St0rm.iD
+1 for linux avatar + vb question
May 14, 2003, 7:53 PM

Search