Valhalla Legends Forums Archive | Battle.net Bot Development | Profile Request [VB]

AuthorMessageTime
Sonic
For some reason whenever I request another users profile, it sets my profile to theirs. I'm not exactly sure why either, here's my code.

Request Profile Menu:
[code]
Private Sub mnuGetProfile_Click()
frmProfile.txtName.text = frmMain.lvChannel.SelectedItem.text
RequestProfile (lvChannel.SelectedItem.text)
End Sub
[/code]

RequestProfile()
[code]
Public Function RequestProfile(strUser As String)
With pbuffer
.InsertDWORD 1
.InsertDWORD 4
.InsertDWORD &H26
.InsertNTString strUser
.InsertNTString "Profile\Sex"
.InsertNTString "Profile\Age"
.InsertNTString "Profile\Location"
.InsertNTString "Profile\Description"
.sendPacket &H26
End With
End Function[/code]

Now when I actually WANT to save my profile I have this:

On frmProfile:
[code]
Public Sub cmdSave_Click()
OtherCode.SetProfile (txtName.text)
Unload Me
End Sub[/code]

SetProflie()
[code]
Public Sub SetProfile(ByVal username As String)
With pbuffer
.InsertDWORD 1
.InsertDWORD 4
.InsertNTString username
.InsertNTString "profile\sex"
.InsertNTString "profile\age"
.InsertNTString "profile\location"
.InsertNTString "profile\description"
.InsertNTString frmProfile.txtSex.text 'Sex
.InsertNTString frmProfile.txtAge.text 'Age
.InsertNTString frmProfile.txtLocation.text 'Location
.InsertNTString frmProfile.rtbDescription.text 'Description
.sendPacket &H27
End With
End Sub
[/code]

Any Suggestions?
March 8, 2004, 7:45 PM
Kp
[quote author=Sonic link=board=17;threadid=5670;start=0#msg48365 date=1078775147]Any Suggestions?[/quote]

I don't see anything wrong with your code to cause what you describe, but I do see some minor inconsistencies relative to the real clients. In particular, they do not capitalize any letters in the profile key names. Also, the clients request 5 keys, not 4. The first four keys are as you requested (though lowercase); the fifth one is an empty string. Its purpose is unknown, but for maximum compatibility, you should request it too.
March 8, 2004, 9:43 PM
PaiD
Only thing I can see that might be a problem might be that you used StrUser. I think if you also named that as your name to login to bnet that might cause a problem. (I am just saying this b/c you said it always sends your profile)
March 8, 2004, 9:46 PM
Sonic
Nope, by name to login isn't strUser, it's varUser. Thanks Kp, I made all uppercase letters lowercase and added the extra key. As far as I can tell, it works.
March 8, 2004, 9:49 PM
Sonic
eh, nevermind..still gives same error. :(

Edit: Oddly enough, it's working again...except now it won't set the profile when I need it to.

Edit #2: OK, I must have written self-tampering code, since it is doing the orgin error again. I have no clue why it's fixing/breaking itself though.
March 8, 2004, 9:52 PM
Kp
[quote author=Sonic link=board=17;threadid=5670;start=0#msg48405 date=1078782736]eh, nevermind..still gives same error. :([/quote]

Yes, was rather surprised to see you say it was working. The changes I suggested have nothing to do with solving the immediate problem, only with making your client more realistic to the server. :P Perhaps you should put a msgbox or an AddChat in the subroutine(s) which send out the set-profile command, so you can see what's causing them to be triggered? (Or if you're comfortable with a debugger, put a breakpoint on those routines and view the call stack. If you don't understand that last sentence, you aren't comfortable with a debugger. :))
March 8, 2004, 9:54 PM
Sonic
Kp: Not sure if you read after my second edit. Anyway, so my code is all correct and you don't know why it would be giving this error?
March 8, 2004, 10:42 PM
Kp
[quote author=Sonic link=board=17;threadid=5670;start=0#msg48423 date=1078785734]
Kp: Not sure if you read after my second edit. Anyway, so my code is all correct and you don't know why it would be giving this error?[/quote]

I had not seen those edits until I returned just now. I do not write VB code (and therefore read it only moderately well), so I won't say with total certainty your code is flawless, especially since I haven't seen all of it. As I said in my prior post, you should try adding print messages in the various subroutines to locate what's causing the call that sets the profile.
March 8, 2004, 10:55 PM
Sonic
OK, I'm really suprised/embarrased I didn't see this earlier. On frmProfile, in Form_Unload I called cmdSave. I thought that it woudln't do anything unless you're on that name so I added it as a convience thing since I'd rather click the x than save. After I removed that..it worked. Thanks for helping me make it more client-like and stuff.
March 9, 2004, 12:43 AM

Search