Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Sidoh on September 20, 2003, 12:38 AM

Title: Stupid CSB q
Post by: Sidoh on September 20, 2003, 12:38 AM
Hey, im having problems getting the "RequestKey" to work with cleanslatebot... here's what im sending:

  CSB.RequestKey Profile, ChannelList.SelectedItem, "sex", "age", "user", "Username", "username"

ive tried them seperatly too, but when the keyreturn is activated, it has no KeyValue... any ideas?
Title: Re:Stupid CSB q
Post by: Yoni on September 20, 2003, 04:13 AM
Not that familiar with CSB.RequestKey but try "Profile\Sex" instead of "Sex", "Profile\Age" instead of "Age", etc.
Title: Re:Stupid CSB q
Post by: iago on September 20, 2003, 06:17 AM
Wasn't Age disabled?  I know that wouldn't solve your problem, but I doubt you'll get any information from profile/age.
Title: Re:Stupid CSB q
Post by: blinkdude on September 20, 2003, 10:22 AM
im sure you got the same problum i had... location / age / sex isn't working for me but Des. is ... duno y .....  heres the code cup head has for it
Req click.

CleanSlateBot1.RequestKey Profile, Listnamehere.SelectedItem.Text, "Profile\Age", "Profile\Sex", "Profile\Description", "Profile\Location"

*******

Private Sub CleanSlateBot1_KeyReturn(KeyName As String, KeyValue As String)
   Select Case KeyName
       Case "Profile\Age"
           TempAge = KeyValue
       Case "Profile\Sex"
           TempSex = KeyValue
       Case "Profile\Location"
           TempLoc = KeyValue
       Case "Profile\Description"
           TempDesc = KeyValue
           Dim Profile As New frmProfile
           Profile.txtUsername.Text = ListView1.SelectedItem.Text
           Profile.Caption = ListView1.SelectedItem.Text & "'s Profile"
           Profile.txtAge.Text = Replace(TempAge, Chr(10), vbCrLf)
           Profile.txtSex.Text = Replace(TempSex, Chr(10), vbCrLf)
           Profile.txtDescription.Text = Replace(TempDesc, Chr(10), vbCrLf)
           Profile.txtLocation.Text = Replace(TempLoc, Chr(10), vbCrLf)
           If CleanSlateBot1.Username = ListView1.SelectedItem.Text Then Profile.cmdSave.Enabled = True
           Profile.Show
       Case Else
           rtbadd vbRed, KeyName & " : " & KeyValue & vbNewLine, vbRed
   End Select
End Sub

heres an ss or my bot with CSB working for profile but no location ...
http://eternalsoldiers.net/esbot/ss/ss3.gif
Title: As best I recall:
Post by: Kp on September 20, 2003, 10:23 AM
Quote from: iago on September 20, 2003, 06:17 AMWasn't Age disabled?  I know that wouldn't solve your problem, but I doubt you'll get any information from profile/age.
There is some server-side hack that forces it to be empty.  However, until such time as the client you're emulating is patched to stop requesting profile\age, you should request it too for compatibility (even though, as iago says, it will be empty).
Title: Re:Stupid CSB q
Post by: Spht on September 20, 2003, 01:46 PM
Quote from: blinkdude on September 20, 2003, 10:22 AM
im sure you got the same problum i had... location / age / sex isn't working for me but Des. is ... duno y .....  heres the code cup head has for it
Req click.

CleanSlateBot1.RequestKey Profile, Listnamehere.SelectedItem.Text, "Profile\Age", "Profile\Sex", "Profile\Description", "Profile\Location"

*******

Private Sub CleanSlateBot1_KeyReturn(KeyName As String, KeyValue As String)
   Select Case KeyName
       Case "Profile\Age"
           TempAge = KeyValue
       Case "Profile\Sex"
           TempSex = KeyValue
       Case "Profile\Location"
           TempLoc = KeyValue
       Case "Profile\Description"
           TempDesc = KeyValue
           Dim Profile As New frmProfile
           Profile.txtUsername.Text = ListView1.SelectedItem.Text
           Profile.Caption = ListView1.SelectedItem.Text & "'s Profile"
           Profile.txtAge.Text = Replace(TempAge, Chr(10), vbCrLf)
           Profile.txtSex.Text = Replace(TempSex, Chr(10), vbCrLf)
           Profile.txtDescription.Text = Replace(TempDesc, Chr(10), vbCrLf)
           Profile.txtLocation.Text = Replace(TempLoc, Chr(10), vbCrLf)
           If CleanSlateBot1.Username = ListView1.SelectedItem.Text Then Profile.cmdSave.Enabled = True
           Profile.Show
       Case Else
           rtbadd vbRed, KeyName & " : " & KeyValue & vbNewLine, vbRed
   End Select
End Sub

heres an ss or my bot with CSB working for profile but no location ...
http://eternalsoldiers.net/esbot/ss/ss3.gif

That will only work if Profile\Description is the last key KeyReturn() sends to you. A simple way to find out what order you get them in, is:


Private Sub CleanSlateBot1_KeyReturn(KeyName As String, KeyValue As String)
   Debug.Print "KeyReturn(" & KeyName & ", " & KeyValue & ")"
End Sub


Now request someone's profile. Whichever key you get last, move your profile dialog display there. For example, if Profile\Age is the last you get, then:


Private Sub CleanSlateBot1_KeyReturn(KeyName As String, KeyValue As String)
   Select Case KeyName
       Case "Profile\Age"
           TempAge = KeyValue
           Dim Profile As New frmProfile
           Profile.txtUsername.Text = ListView1.SelectedItem.Text
           Profile.Caption = ListView1.SelectedItem.Text & "'s Profile"
           Profile.txtAge.Text = Replace(TempAge, Chr(10), vbCrLf)
           Profile.txtSex.Text = Replace(TempSex, Chr(10), vbCrLf)
           Profile.txtDescription.Text = Replace(TempDesc, Chr(10), vbCrLf)
           Profile.txtLocation.Text = Replace(TempLoc, Chr(10), vbCrLf)
           If CleanSlateBot1.Username = ListView1.SelectedItem.Text Then Profile.cmdSave.Enabled = True
           Profile.Show
       Case "Profile\Sex"
           TempSex = KeyValue
       Case "Profile\Location"
           TempLoc = KeyValue
       Case "Profile\Description"
           TempDesc = KeyValue
       Case Else
           rtbadd vbRed, KeyName & " : " & KeyValue & vbNewLine, vbRed
   End Select
End Sub
Title: Re:Stupid CSB q
Post by: blinkdude on September 20, 2003, 03:55 PM
i tryed it that way for like a day or two then just did it this way it works.... but it will pop up the Profile Form on any keyreturn...

Private Sub CleanSlateBot1_KeyReturn(KeyName As String, KeyValue As String)
frmProfile.txtUsername.Text = ListView1.SelectedItem.Text
frmProfile.Caption = ListView1.SelectedItem.Text & "'s Profile"

If KeyName = "Profile\Age" Then
  TempAge = KeyValue
  frmProfile.txtAge.Text = TempAge
   Else
   End If
   
If KeyName = "Profile\Sex" Then
  TempSex = KeyValue
  frmProfile.txtSex.Text = TempSex
   Else
   End If
   
If KeyName = "Profile\Location" Then
 TempLoc = KeyValue
 frmProfile.txtLocation.Text = TempLoc
  Else
End If

If KeyName = "Profile\Description" Then
  TempDesc = KeyValue
  frmProfile.txtDescription.Text = TempDesc
  Else
End If

   If CleanSlateBot1.Username = ListView1.SelectedItem.Text Then frmProfile.cmdSave.Enabled = True
           frmProfile.Show
End sub
Title: Re:Stupid CSB q
Post by: iago on September 20, 2003, 04:11 PM
That will only display one thing on the form, since KeyName will only ever be one of those options.
Title: Re:Stupid CSB q
Post by: Sidoh on September 21, 2003, 06:00 PM
Okay, new question, how do you request record data?
Title: Re:Stupid CSB q
Post by: iago on September 21, 2003, 06:08 PM
void BinaryBot::SendRecDataRequest(string User)
{
   LastProfileName = User;
   Buffer Request;
   Request << (DWORD) 1; // One user
   Request << (DWORD) 31; // With 31 fields
   Request << RecDataCookie; // The record cookie
   Request << User << (BYTE) 0; // The username

   Request << "profile\\sex" << (BYTE) 0; // The standard profile data
   Request << "profile\\age" << (BYTE) 0;
   Request << "profile\\location" << (BYTE) 0;
   Request << "profile\\description" << (BYTE) 0;
   
   Request << "Record\\SEXP\\0\\wins" << (BYTE) 0; // Brood war regular stuff
   Request << "Record\\SEXP\\0\\losses" << (BYTE) 0;
   Request << "Record\\SEXP\\0\\disconnects" << (BYTE) 0;
   Request << "Record\\SEXP\\0\\last game result" << (BYTE) 0;
   Request << "Record\\SEXP\\1\\wins" << (BYTE) 0; // Brood war ladder stuff
   Request << "Record\\SEXP\\1\\losses" << (BYTE) 0;
   Request << "Record\\SEXP\\1\\disconnects" << (BYTE) 0;
   Request << "Record\\SEXP\\1\\rating" << (BYTE) 0;
   Request << "Record\\SEXP\\1\\last game result" << (BYTE) 0;
   
   Request << "Record\\STAR\\0\\wins" << (BYTE) 0; // Starcraft regular
   Request << "Record\\STAR\\0\\losses" << (BYTE) 0;
   Request << "Record\\STAR\\0\\disconnects" << (BYTE) 0;
   Request << "Record\\STAR\\0\\last game result" << (BYTE) 0;
   Request << "Record\\STAR\\1\\wins" << (BYTE) 0; // Starcraft ladder
   Request << "Record\\STAR\\1\\losses" << (BYTE) 0;
   Request << "Record\\STAR\\1\\disconnects" << (BYTE) 0;
   Request << "Record\\STAR\\1\\rating" << (BYTE) 0;
   Request << "Record\\STAR\\1\\last game result" << (BYTE) 0;
   
   Request << "Record\\W2BN\\0\\wins" << (BYTE) 0; // War2 regular
   Request << "Record\\W2BN\\0\\losses" << (BYTE) 0;
   Request << "Record\\W2BN\\0\\disconnects" << (BYTE) 0;
   Request << "Record\\W2BN\\0\\last game result" << (BYTE) 0;
   Request << "Record\\W2BN\\1\\wins" << (BYTE) 0; // War2 ladder
   Request << "Record\\W2BN\\1\\losses" << (BYTE) 0;
   Request << "Record\\W2BN\\1\\disconnects" << (BYTE) 0;
   Request << "Record\\W2BN\\1\\rating" << (BYTE) 0;
   Request << "Record\\W2BN\\1\\last game result" << (BYTE) 0;

   SendBNetPacket(SID_READUSERDATA, Request);
}
Title: Re:Stupid CSB q
Post by: Sidoh on September 21, 2003, 06:21 PM
Odd, that doesn't seem to work.. (i made sure to change everything to vb from c++), the value it returns is blank. Per haps im just being stupid
Title: Re:Stupid CSB q
Post by: Spht on September 21, 2003, 06:25 PM
Quote from: Sidoh on September 21, 2003, 06:21 PM
Odd, that doesn't seem to work.. (i made sure to change everything to vb from c++), the value it returns is blank. Per haps im just being stupid

Use one slash (\) instead of two. There's two in his sample to avoid it being recognized as a C++ operator.
Title: Re:Stupid CSB q
Post by: iago on September 21, 2003, 06:29 PM
Yes, I should have mentioned.. and you might not need the (BYTE) 0, depending on how your buffer works :)
Title: Re:Stupid CSB q
Post by: Sidoh on September 21, 2003, 06:42 PM
Okay, its working now, thanks  ;D
Title: Re:Stupid CSB q
Post by: Soul Taker on September 21, 2003, 06:54 PM
What about Ironman stats =P
Title: Re:Stupid CSB q
Post by: Sidoh on September 21, 2003, 07:00 PM
Okay I have another question. When I request the key
"Record\SEXP\0\last game", I get a weird keyreturn. It in no way resembles the time or date of the last game.

Heres what I got:
Key Return (Keyname: Record\SEXP\0\last game, KeyValue: 29587645 2393367080)

When the actual time/date was:
9/11/2003 17:33

Anyone know how this is parsed?
Title: Re:Stupid CSB q
Post by: iago on September 21, 2003, 08:33 PM
Of course there is, I just didn't care enough to add it to my request string.  

btw, a simple "thank you" would be more appreciated than, "give me more".  Just for future reference.
Title: Re:Stupid CSB q
Post by: Sidoh on September 21, 2003, 08:36 PM
Yeah, I felt bad about that :( I'm sorry, THANK YOU!  ;D
Title: Re:Stupid CSB q
Post by: Soul Taker on September 21, 2003, 08:41 PM
Quote from: Sidoh on September 21, 2003, 07:00 PM
Okay I have another question. When I request the key
"Record\SEXP\0\last game", I get a weird keyreturn. It in no way resembles the time or date of the last game.

Heres what I got:
Key Return (Keyname: Record\SEXP\0\last game, KeyValue: 29587645 2393367080)

When the actual time/date was:
9/11/2003 17:33

Anyone know how this is parsed?

Look up FileTime structures on MSDN.