Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: EviL_MarinE on October 24, 2004, 03:55 PM

Title: A problem, help plz
Post by: EviL_MarinE on October 24, 2004, 03:55 PM
Hey, 3rd post soz ;(

But my problem is:

My bot is sending data:


Private Sub BnetSocket_Connect()
Display frmMain.ChatRoom, True, True, vbGreen, "BNET: Connected to Battle.net!"
    bnetSocket.SendData Chr(1)
    Send0x50
End Sub


So then it SHOULD go to:


Private Sub bnetsocket_DataArrival(ByVal bytesTotal As Long)
Static strBuffer As String
Dim strTemp As String, lngLen As Long
    bnetSocket.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
        ParseBnet (Left(strBuffer, lngLen))
        strBuffer = Mid(strBuffer, lngLen + 1)
    Wend
End Sub


But it doesnt, Any ideas?
Title: Re: A problem, help plz
Post by: Minux on October 24, 2004, 04:30 PM
Quote from: EviL_MarinE on October 24, 2004, 02:15 PM
AH, k thanks.

Well i did just use www.valhallalegends.com in the end and it worked

Thanks for the help in other forum btw :)

Didn't you already get your connection to work?
Title: Re: A problem, help plz
Post by: Warrior on October 24, 2004, 04:40 PM
I have no idea why your DataArrival Sub is so big.

Straight out of my Bot


Private Sub sckBNCS_DataArrival(ByVal bytesTotal As Long)
    Dim Packets As String
        sckBNCS.GetData Packets, vbString
            BNCS.ParsePacket Packets
End Sub


Assuming you do Public BNCS as New BNCS also assuming you name your class BNCS



Public Function ParsePacket(Data As String)
    Dim Header As String
        If Data = vbNullString Then Exit Sub
            Header = Asc(Mid(Data, 2, 1))
        Select Case Header
            Case &H50 'SID_AUTH_INFO
                'Parse
           Case Else 'Packet Handling
                'Handle Unknown Packet
        End Select
End Function


Or something along those lines.
Title: Re: A problem, help plz
Post by: Stealth on October 24, 2004, 04:55 PM
His code checks the validity of the packet. Battle.net will sometimes send you multiple or partial packets, so if you try and parse them, you won't succeed.
Title: Re: A problem, help plz
Post by: Warrior on October 24, 2004, 05:00 PM
Hrm never knew that.
Title: Re: A problem, help plz
Post by: UserLoser. on October 24, 2004, 09:10 PM
Bad idea to check for only packets > 4 in length, you could miss a lot of things
Title: Re: A problem, help plz
Post by: Minux on October 24, 2004, 10:53 PM
Quote from: UserLoser on October 24, 2004, 09:10 PM
Bad idea to check for only packets > 4 in length, you could miss a lot of things

Forgive me for saying, but I don't think he wrote that himself. He most likely acquired from somebody elses source code. Otherwise he would probably agree with you.
Title: Re: A problem, help plz
Post by: EviL_MarinE on October 25, 2004, 04:08 AM
hmm, minus i tried ur coding and still not,  It just doesnt go to data arrival, maybe the data isnt being sent? Oh but it is:


    bnetSocket.SendData Chr(1)


Hmmm, It should go to the Data Arrival, and i know it doesnt because i put a msgbox in there to say if it had gone to that, and the msg never came up... Any ideas people
Title: Re: A problem, help plz
Post by: EviL_MarinE on October 25, 2004, 05:29 AM

[11:23:06] Welcome To iLLuSiOn Bot 1.0.0 By EviL_MarinE
[11:23:07] BNLS: Connecting To bnls.valhallalegends.com
[11:23:07] BNLS: Connected to BNLS!
[11:23:08] BNET: Connected to Battle.net server 213.248.106.204
[11:23:09] Unhandled Packet: 0x05
[11:23:09]  FF 05 14 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[11:23:09] Unhandled Packet: 0x01D
[11:23:09]  FF 1D 0C 00 D8 9A 04 00 15 09 16 EF


Thats my bot, and im getting 2 unhandled packets, i think 0x01D is LogonChallange ? and 0x05 Is SID_CLIENT_ID ?? Correct me if im wrong plz ;)

Has anybody got any ideas WHY im getting these 2 unhandled packets?


        Case Else
            If Len(PacketId) = 1 Then
                Display frmMain.ChatRoom, True, True, vbRed, "Unhandled Packet: 0x0" & Hex(PacketId)
            Else
                Display frmMain.ChatRoom, True, True, vbRed, "Unhandled Packet: 0x" & Hex(PacketId)
            End If
            Display frmMain.ChatRoom, True, True, vbRed, StrToHex(data)
    End Select
End Sub

The PacketID is going to 1 it seems, hmm, can anybody help me here?
Title: Re: A problem, help plz
Post by: Warrior on October 25, 2004, 05:43 AM
Are you talking to yourself or did you just post 4 times on purpose?
Title: Re: A problem, help plz
Post by: EviL_MarinE on October 25, 2004, 05:47 AM
Umm, talking to myself i think ^_^
Title: Re: A problem, help plz
Post by: LivedKrad on October 25, 2004, 12:06 PM
Quote from: EviL_MarinE on October 25, 2004, 04:08 AM
hmm, minus i tried ur coding and still not,  It just doesnt go to data arrival, maybe the data isnt being sent? Oh but it is:


    bnetSocket.SendData Chr(1)


Hmmm, It should go to the Data Arrival, and i know it doesnt because i put a msgbox in there to say if it had gone to that, and the msg never came up... Any ideas people

You based your questions on the validity of your DataArrival sub by parsing a response for Chr(1)?
Title: Re: A problem, help plz
Post by: EviL_MarinE on October 25, 2004, 12:46 PM
LivedKrad, dont take notice of that post, take notice of my latest One, All pelase help me on this:
Quote from: EviL_MarinE on October 25, 2004, 05:29 AM

[11:23:06] Welcome To iLLuSiOn Bot 1.0.0 By EviL_MarinE
[11:23:07] BNLS: Connecting To bnls.valhallalegends.com
[11:23:07] BNLS: Connected to BNLS!
[11:23:08] BNET: Connected to Battle.net server 213.248.106.204
[11:23:09] Unhandled Packet: 0x05
[11:23:09] FF 05 14 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[11:23:09] Unhandled Packet: 0x01D
[11:23:09] FF 1D 0C 00 D8 9A 04 00 15 09 16 EF


Thats my bot, and im getting 2 unhandled packets, i think 0x01D is LogonChallange ? and 0x05 Is SID_CLIENT_ID ?? Correct me if im wrong plz ;)

Has anybody got any ideas WHY im getting these 2 unhandled packets?


Case Else
If Len(PacketId) = 1 Then
Display frmMain.ChatRoom, True, True, vbRed, "Unhandled Packet: 0x0" & Hex(PacketId)
Else
Display frmMain.ChatRoom, True, True, vbRed, "Unhandled Packet: 0x" & Hex(PacketId)
End If
Display frmMain.ChatRoom, True, True, vbRed, StrToHex(data)
End Select
End Sub

The PacketID is going to 1 it seems, hmm, can anybody help me here?

Thanks for your time and effort :)
Title: Re: A problem, help plz
Post by: R.a.B.B.i.T on October 25, 2004, 08:11 PM
Quote from: EviL_MarinE on October 25, 2004, 05:29 AM

[11:23:06] Welcome To iLLuSiOn Bot 1.0.0 By EviL_MarinE
[11:23:07] BNLS: Connecting To bnls.valhallalegends.com
[11:23:07] BNLS: Connected to BNLS!
[11:23:08] BNET: Connected to Battle.net server 213.248.106.204
[11:23:09] Unhandled Packet: 0x05
[11:23:09]  FF 05 14 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[11:23:09] Unhandled Packet: 0x01D
[11:23:09]  FF 1D 0C 00 D8 9A 04 00 15 09 16 EF

More of a sidenote: you should use (Grok's?) DebugOutput(), which is available on the BotDev page, it will make life so much easier later on.
Title: Re: A problem, help plz
Post by: Blaze on October 25, 2004, 08:35 PM
Quote from: R.a.B.B.i.T on October 25, 2004, 08:11 PM
More of a sidenote: you should use (Grok's?) DebugOutput(), which is available on the BotDev page, it will make life so much easier later on.

Plus it looks much better..
Title: Re: A problem, help plz
Post by: EviL_MarinE on October 26, 2004, 06:03 AM
;o well i was talking  to my old friend (Pro_User) and he sed "Scrap the BNLS idea" and then he spent about 1hr or so going through connecting to battle.net and it really helped! I then went to bed and came on this morning to find that he had built me a "noob proof" conenction to battle.net to help me! It has really made me learn alot so far!

+++++++++
Dont bother posting bk to this !
Title: Re: A problem, help plz
Post by: Kp on October 26, 2004, 10:21 AM
Quote from: EviL_MarinE on October 26, 2004, 06:03 AM
;o well i was talking  to my old friend (Pro_User) and he sed "Scrap the BNLS idea" and then he spent about 1hr or so going through connecting to battle.net and it really helped! I then went to bed and came on this morning to find that he had built me a "noob proof" conenction to battle.net to help me! It has really made me learn alot so far!

+++++++++
Dont bother posting bk to this !

I would hardly consider such a person "friend".  His action has deprived you of the learning that would come of actually accomplishing this.  On top of that, I rather doubt you've learned any debugging skill from all this.  Most people who solve their own problems at least learn a bit about debugging, and are better able to solve problems on their own the next time around.  What will you do the next time something breaks?
Title: Re: A problem, help plz
Post by: Warrior on October 26, 2004, 10:39 AM
Post here of course!
Title: Re: A problem, help plz
Post by: LivedKrad on October 26, 2004, 12:08 PM
I would presume an unhandled packet would be a packet that has not been handled. So, I would also venture a guess that the solution to this problem, would be to handle the packet. It is also by this train of logic that I would assume that you *do not* know how to parse/handle/cram up your ass such packets. Please correct me if wrong.
Title: Re: A problem, help plz
Post by: EviL_MarinE on October 26, 2004, 12:43 PM

Quote from: EviL_MarinE on October 26, 2004, 06:03 AM

+++++++++
Dont bother posting bk to this !
[/qoute]

LivedKrad, ...? -_-V

I just said in my post ive restarted and i dont need help anymore, and please do not say "i cant parse", Get your facts right
Title: Re: A problem, help plz
Post by: LivedKrad on October 26, 2004, 04:54 PM
So, your argument that you can indeed parse these packets is backed up by the fact that you received code someone else wrote? That makes absolutely no sense.
Title: Re: A problem, help plz
Post by: Minux on October 26, 2004, 06:18 PM
Why don't we test him? Of course, on BNET, so he can't look up the answers :P
Title: Re: A problem, help plz
Post by: EviL_MarinE on October 27, 2004, 06:44 AM
ok here is what im doing, to make it so you lot understand *sigh*

Pro_User gave me a working code that connects to bnet, i dled it.
I said that  i dont wanna "cheat" and steal code, he said:

"Use this code to learn on how to connect to bnet, users talking, and even try a creating game, and channel lists, then when you have learnt most of it then try it on your own"

This is my way of learning atm, and i have tbh learnt on how to connect to bnet and confident on doing it myself, but first i will finish the rest of..


Does this all explain it now?
Title: Re: A problem, help plz
Post by: Soul Taker on October 27, 2004, 07:45 AM
Quote from: EviL_MarinE on October 27, 2004, 06:44 AM
ok here is what im doing, to make it so you lot understand *sigh*

Pro_User gave me a working code that connects to bnet, i dled it.
I said that  i dont wanna "cheat" and steal code, he said:

"Use this code to learn on how to connect to bnet, users talking, and even try a creating game, and channel lists, then when you have learnt most of it then try it on your own"

This is my way of learning atm, and i have tbh learnt on how to connect to bnet and confident on doing it myself, but first i will finish the rest of..


Does this all explain it now?
Maybe... but I only speak English  :-\
Title: Re: A problem, help plz
Post by: LivedKrad on October 27, 2004, 10:36 AM
I wasn't fishing for an explanation. If I wanted to know why you read from others' code to learn, then I'd ask you why you want to do things the wrong way. However, I was asking how you justified your argument on being able to parse/handle certain packets based on simply downloading another person's code.
Title: Re: A problem, help plz
Post by: EviL_MarinE on October 27, 2004, 12:41 PM
I dont, but i learn from it so i can ?
Title: Re: A problem, help plz
Post by: Warrior on October 27, 2004, 03:39 PM
Dont take this the wrong way but looking at other people's code ruins the feeling of acomplishment you get when you successfully logon. If I were you id learn from documentation, not examples aka ripped sources.
Title: Re: A problem, help plz
Post by: LivedKrad on October 27, 2004, 04:26 PM
Sufficing knowledge of the syntax may help also.
Title: Re: A problem, help plz
Post by: Minux on October 28, 2004, 12:09 AM
It is true that with Visual Basic, you can learn from sources. It is the only language it seems, that you can learn from viewing sources. HOWEVER, this route takes almost three times longer, and once you reach an intermediate level, you lack the knowledge which you should have learned along the way. You get into the habit of looking at other sources, and you are always asking for help, and expecting people just to give you the answer instead of learning it.

Edit: Also, there are alot of things like Bytes, Words, DWORDS, Longs, Single, Double etc..
That you only can associate with other's sources....and it takes a while to fully understand that without reading the proper documentation. Therefore my conclusion is, packet logs will seem like GREEK to you.

My opinion ~ Minus
Title: Re: A problem, help plz
Post by: EviL_MarinE on October 28, 2004, 05:45 AM
heh, Warrior is absolutey right, i didnt get the "feeling" when i got another persons code online :(

But now i have actaully learnt logging on to bnet and i am working on my own to do it, but as well as doing this i am working out channel view ect...

Yes i have a habit to look at other sources, but it will soon pass

thanks for pointing me into the right place, as now i dont copy :P

And i cant wait til >I< get a bot on >MYSELF< with >MY< coding :D:D

Since now i know how to logon to bnet i am capable doing it myself

thanks you lot
Title: Re: A problem, help plz
Post by: MyndFyre on October 28, 2004, 08:54 AM
Are you capable of debugging it yourself?  So basically what you're telling us is, since you know it, you won't be coming to us with your problems if/when it doesn't work right?
Title: Re: A problem, help plz
Post by: EviL_MarinE on October 28, 2004, 10:46 AM
Hmm, well i think i CAN do logging onto to bnet myself, might need some help

But the only thing im not sure on is, Hmm maybe the "Packetclass" in my case, The .Insertdword ect... And the Socket_DataArrival, maybe i can do it, but if i cant i might ask :)

- if you dont mind!  ;D
Title: Re: A problem, help plz
Post by: Warrior on October 28, 2004, 11:19 AM
Well if your going to do this correctly and do your homework on Battle.net then I think we would be glad to help.
Title: Re: A problem, help plz
Post by: LivedKrad on October 28, 2004, 12:01 PM
Quote from: EviL_MarinE on October 28, 2004, 10:46 AM
Hmm, well i think i CAN do logging onto to bnet myself, might need some help

But the only thing im not sure on is, Hmm maybe the "Packetclass" in my case, The .Insertdword ect... And the Socket_DataArrival, maybe i can do it, but if i cant i might ask :)

- if you dont mind!  ;D

.Insertdword? I wasn't aware this was an intrinsic function/method to Visual BASIC.  But, looking upon others' code has revealed to me that .Insertdword has come to be a function in many people's packet parsing modules. It looks like  nothing more than a small piece of code calling an additional function to shift certain bytes of data to create a "DWORD". So, I don't understand your supposed "small problem" with two different things that are completely unrelated to each other, such as this "Packetclass" and the method .Insertdword. So, if you could reply back with more... customized versions of these procedures, then I would also be more than happy to help in any way I can.
Title: Re: A problem, help plz
Post by: EviL_MarinE on October 28, 2004, 01:05 PM
ah LivedKrad thx thx, now i understand!

Btw "PacketClass" is my class module with Inserting dwords, words, bytes, byte ect......

Thx for helping me out, i started my bot like 10 mins ago and kinda doing good @_@

Only thing stuck on, Data Arrival, what to put for it? :(
Title: Re: A problem, help plz
Post by: MyndFyre on October 28, 2004, 01:48 PM
Quote from: EviL_MarinE on October 28, 2004, 01:05 PM
Btw "PacketClass" is my class module with Inserting dwords, words, bytes, byte ect......
Just as an editorial note, I think it's at best redundant and at worst poor practice to prepend or append a name of a class with "Class."  If someone, including yourself, is using your class, knowing full well that it is a class, then doesn't it somewhat defeat the point of naming it "-Class"?

Quote from: EviL_MarinE on October 28, 2004, 01:05 PMi started my bot like 10 mins ago and kinda doing good @_@

Only thing stuck on, Data Arrival, what to put for it? :(
So....  by "doing good(sic)" you mean you've managed to drag and drop controls onto a form?  What is hard about understanding what to put for the DataArrival event?  You put code there that processes data that has arrived....
Title: Re: A problem, help plz
Post by: EviL_MarinE on October 28, 2004, 01:58 PM
Hmm yeah thx MyndFyre, thx for help :)

Now doing Data Arrival but gtg so bye lol
Title: Re: A problem, help plz
Post by: LivedKrad on October 28, 2004, 04:45 PM
So, what exactly do you plan to do with this magical "PacketClass"? And also, you've resolved to start on your Data_Arrival event, what then, are you planning to do for that? Code would be appreciated BTW. :P
Title: Re: A problem, help plz
Post by: R.a.B.B.i.T on October 31, 2004, 04:31 PM
The closest any Visual BASIC programmer should get to looking at other people's code is looking at the examples in API-Guide (http://www.allapi.net/) when looking at an API call for the first time.
Title: Re: A problem, help plz
Post by: shadypalm88 on October 31, 2004, 05:31 PM
Quote from: R.a.B.B.i.T on October 31, 2004, 04:31 PM
The closest any Visual BASIC programmer should get to looking at other people's code is looking at the examples in API-Guide (http://www.allapi.net/) when looking at an API call for the first time.
Well... that is how I learned Visual Basic.  I started tinkering around with a fully-working bot.  I knew the author so I could ask questions about it along the way.

After messing with it a lot I started to feel comfortable with VB.  Then I wrote my own bot from scratch.

Although, keep in mind:
1. VB was not my first [programming] language.  (PHP was.)
2. The bot I wrote was organized very differently than the original one I played with (mine was more OO, for one).  I wasn't just recoding the original (or copying and pasting).  I made an effort to understand what was going on, and then tried to do it better.

So I guess it can work for some people.  My VB "skillz" didn't turn out too bad, if I do say so myself.
Title: Re: A problem, help plz
Post by: LivedKrad on November 01, 2004, 12:13 PM
Yes they did Eric, you're horrible! :p
Title: Re: A problem, help plz
Post by: Eric on November 02, 2004, 02:00 AM
Quote from: R.a.B.B.i.T on October 31, 2004, 04:31 PM
The closest any Visual BASIC programmer should get to looking at other people's code is looking at the examples in API-Guide (http://www.allapi.net/) when looking at an API call for the first time.
So you're saying that learning through example is frowned apon now?  Pretty soon people will be flamed because they learned how to program by reading a book or taking a class.

Quote from: R.a.B.B.i.TMore of a sidenote: you should use (Grok's?) DebugOutput(), which is available on the BotDev page, it will make life so much easier later on.

Quite contradicting views.
Title: Re: A problem, help plz
Post by: MyndFyre on November 02, 2004, 09:09 AM
Quote from: LoRd[nK] on November 02, 2004, 02:00 AM
Quote from: R.a.B.B.i.T on October 31, 2004, 04:31 PM
The closest any Visual BASIC programmer should get to looking at other people's code is looking at the examples in API-Guide (http://www.allapi.net/) when looking at an API call for the first time.
So you're saying that learning through example is frowned apon now?  Pretty soon people will be flamed because they learned how to program by reading a book or taking a class.

No, I don't think that's the issue.  I think the issue is this process:

1.) Take someone else code example, if the example is actually a product.
2.) Change things around, play with it, examine the changes.
3.) Package it as your own product, giving no credit to the original author.

Nobody publishes the "Hello, world" example as their own.  But, say I make my bot open-source, someone downloads it, changes the title and some cosmetic things, and recompiles it, publishes it himself as ]sC4M[b0t (ph33r I33t h4x0rz!), then yes, there is a problem.  I would be making it open-source so people could learn, NOT so that they could do exactly what I just described.
Title: Re: A problem, help plz
Post by: Minux on November 02, 2004, 03:11 PM
Which is why you need to do what Stealth did, when he released one of his VERY early version sources. He removed a bunch of items, changed a few names on different controls and suddenly any idiot would just say "not worth it" and move on to the next source. I envy him for that.
Title: Re: A problem, help plz
Post by: Eric on November 02, 2004, 03:44 PM
Quote from: MyndFyre on November 02, 2004, 09:09 AM
Quote from: LoRd[nK] on November 02, 2004, 02:00 AM
Quote from: R.a.B.B.i.T on October 31, 2004, 04:31 PM
The closest any Visual BASIC programmer should get to looking at other people's code is looking at the examples in API-Guide (http://www.allapi.net/) when looking at an API call for the first time.
So you're saying that learning through example is frowned apon now?  Pretty soon people will be flamed because they learned how to program by reading a book or taking a class.

No, I don't think that's the issue.  I think the issue is this process:

1.) Take someone else code example, if the example is actually a product.
2.) Change things around, play with it, examine the changes.
3.) Package it as your own product, giving no credit to the original author.

Nobody publishes the "Hello, world" example as their own.  But, say I make my bot open-source, someone downloads it, changes the title and some cosmetic things, and recompiles it, publishes it himself as ]sC4M[b0t (ph33r I33t h4x0rz!), then yes, there is a problem.  I would be making it open-source so people could learn, NOT so that they could do exactly what I just described.
You should be aware of all possible risks and be prepared to accept them before releasing your product as open-source because you can't just leave something like that in the public's eye and then get mad because they don't use it exactly how you expected them to.

You claim to release open-source products to help people understand, however, here you are, refusing to help someone understand and patch up a piece of someone's open-source product.  Rather than deeming him a leecher and criticizing him because of it, wouldn't it be better to just try and help him understand it?

QuoteQuote from: Minus on Today at 01:11:46 PM
Which is why you need to do what Stealth did, when he released one of his VERY early version sources. He removed a bunch of items, changed a few names on different controls and suddenly any idiot would just say "not worth it" and move on to the next source. I envy him for that.
Releasing faulty code is hardly an answer.
Title: Re: A problem, help plz
Post by: Minux on November 02, 2004, 03:53 PM
Quote from: LoRd[nK] on November 02, 2004, 03:44 PM
Releasing faulty code is hardly an answer.

No, the code isn't faulty, but enough things were changed so it would take a while to fix it up for it to compile. It's a great reference, just won't compile. I think that's awesome.

Edit: The answer is, stop providing support for VB robots. And only support C/C#/C++/Java programs therefore leechers won't  bother since learning the language actually takes effort.
Title: Re: A problem, help plz
Post by: Eric on November 02, 2004, 04:01 PM
QuoteNo, the code isn't faulty, but enough things were changed so it would take a while to fix it up for it to compile. It's a great reference, just won't compile.
He delibertely altered his code so that it would not function properly which nearly eliminated the possibility of using it as a learning reference.

QuoteEdit: The answer is, stop providing support for VB robots. And only support C/C#/C++/Java programs therefore leechers won't  bother since learning the language actually takes effort.
People can leech easily in any language since no prior knowledge of the language is required (duh?).