Valhalla Legends Forums Archive | Battle.net Bot Development | 0x35 handling problems...

AuthorMessageTime
LackLuster)
This is probably some newb problem nobody has had, but I am having it, so please don't flame too much -_-.

Anyhoo, I can't get the clan tag out of 0x35 (which is all I want from it, no other information), and I am stumped as to how I should go about this.

Any help is appreciated.
August 1, 2005, 5:23 PM
Spht
Welcome to the Botdev forums.

From BnetDocs:

[quote]Message ID: 0x35
Message Name: SID_PROFILE
Direction: Server -> Client (Received)
Used By: Warcraft III, Warcraft III: TFT
Format:
(DWORD) Cookie
(BYTE) Success
(STRING) Profile\Description value
(STRING) Profile\Location value
(DWORD) Clan Tag

If the status code is 0, the request was successful; otherwise, the lookup failed and the message length will be five bytes long (not counting the four byte header).

Please note: This message's official name is not known, and has been invented.[/quote]

Although you only want the clan tag, you will still need to check the Cookie so you can assign the appropriate name to the profile data.

If the success code is zero, then one way to get the clan tag is measure the length of the two strings, and add 4 bytes for the Cookie and 1 byte for the Success code to get the position of where the clan tag (4 bytes) starts.  Or you could just extract the last 4 bytes of the packet and call it the clan tag, but I wouldn't recommend using this method in any conventional environment.
August 1, 2005, 6:04 PM
LackLuster)
Hm() = Split(Mid(Data, 10), Chr(0)) 
Description = Hm(0) 'Subscript out of range...

I don't know...

I kind of suck at this, I want my chat bot to be able to check what clan a user is in, so I can know whether or not to invite them to my clan (if indeed they want to join).
August 1, 2005, 6:21 PM
R.a.B.B.i.T
Assuming you're using DM's packetbuffer, and this is in VB:
[code]Tag = GetDWORD(Right(Data, 4))[/code]
August 2, 2005, 1:42 AM
LackLuster)
Thanks... I am soooo newb, how do I convert that to text...? =/
August 2, 2005, 2:34 AM
HdxBmx27
Well it should return a Long, So jsut use Hex() to show the Hex of it..
But, You could jsut use Replace() to get rid fo Chr(0)'s and the reverse it.  But Dont use GetDword() if you do this method.
~-~(HDX)~-~
August 2, 2005, 2:37 AM
LackLuster)
How should I best go about getting the data without using GetDWORD?
August 2, 2005, 2:50 AM
HdxBmx27
Replace(Reverse(Right(Data, 4)), Chr(0), VbNullString)
Compleet enuf for you?
~-~(HDX)~-~
August 2, 2005, 3:11 AM
Myndfyr
That's not the best way though.

Do what Spht suggested -- get the four bytes following the cookie, success code, and profile strings.  That is the 100% most accurate way of doing it.  Stop having him read from the Right.

And while you're at it, stop feeding him code that doesn't teach him what to do with what he's got.
August 2, 2005, 3:17 AM

Search