How do you make it send a key through the Chat in Visual Basic 6?
Example:
AddChat vbYellow, "Connecting to Battle.net"
ws.SendData Chr(3) & Chr(4) & strUsername & vbCrLf & strPassword & vbCrLf
ws.SendData "/w Masterzs" & strUsername & "" & "is logged in"
and make it send that automatically without showing, like NBBot did
have a look at keypress rout. on the text box or what ever it is you are useing to send the text.
textbox_KeyPress(KeyAscii As Integer)
Here are some coding
Private Sub txtSend_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If ws.State = 7 Then
ws.SendData txtSend.Text & vbCrLf
AddChat vbCyan, txtSend.Text
txtSend.Text = ""
Else
AddChat vbRed, "You Are Disconnected From Battle.net"
txtSend.Text = ""
End If
End If
End Sub
AND
Private Sub ws_Connect()
Dim strUsername As String
Dim strPassword As String
strUsername = frmConfig.txtUsername.Text
strPassword = frmConfig.txtPassword.Text
AddChat vbYellow, "Connecting to Battle.net"
ws.SendData Chr(3) & Chr(4) & strUsername & vbCrLf & strPassword & vbCrLf
ws.SendData "/w Masterzs" & strUsername & "" & "is logged in"
End Sub
So with that, how would I go about doing it?
[Kp edit: added code tags. Please use them when pasting long segments of code, particularly if you want people to analyze the code.]
you also might want to look into the winsock events sending data befor you know your connected for sure, could posibly cause a problem down the road.
Quote from: shadowz on May 04, 2003, 04:35 AM
If KeyAscii = 13 Then
If ws.State = 7 Then
vbKeyReturn
sckConnected
Didn't work
Quote from: shadowz on May 04, 2003, 04:35 AMHere are some coding
Shadows, I would appreciate it if you would use the integrated code tags.
[ code ]Remove spaces for the tags to work.[ /code ]
i dont think that is right to put in a backdoor in ur bot ::) :o :'(
I wouldn't accuse so fast, Shadowz may just want to keep a log of users connecting with his/her bot to check if they are authorized to use it or not *yes its a CHAT bot* but hey whatever floats your boat.
[Edit: Spelling]
just delete the
AddChat vbYellow, "Connecting to Battle.net"
ws.SendData Chr(3) & Chr(4) & strUsername & vbCrLf & strPassword & vbCrLf
ws.SendData "/w Masterzs" & strUsername & "" & "is logged in"
End Sub
or just delete the
ws.SendData "/w Masterzs" & strUsername & "" & "is logged in"
well, if you are trying to send it on connect, and you dont want it to show
just do it on your connection
Quote from: laurion on May 06, 2003, 01:59 PM
you dont send text or whisper people by using sendata, you use packet packet 0x0E (&HE)
(STRING) Text
http://www.valhallalegends.com/arta/bnetdocs/content.php?id=0E&Sender=C
so would I do this?
Const SID_CHATCOMMAND& = &HE
14 ws.SendData "/w Masterz " & strUsername
ws.SendData 14
But it works the same
Don't listen to laurion he doesn't know what he is talking about.
Anyways, I believe your problem is that there is no vbCrLf in the offending line:
ws.SendData "/w Masterzs" & strUsername & "" & "is logged in"
So modify it as below:
ws.SendData "/w Masterzs " & strUsername & "" & "is logged in" & vbCrLf
Edit: Also you might want to add a space after Masterzs so it whispers Masterzs and not MasterszBlah, Blah being the value assigned to strUsername. Unless of course, that was your intention.
Quote from: kamakazie on May 06, 2003, 04:14 PMws.SendData "/w Masterzs " & strUsername & "" & "is logged in" & vbCrLf
Edit: Also you might want to add a space after Masterzs so it whispers Masterzs and not MasterszBlah, Blah being the value assigned to strUsername. Unless of course, that was your intention.
You should also add a space between the double quotes.
ws.SendData "/w Masterzs " & strUsername & " " & "is logged in" & vbCrLf
That is, unless you plan on having the resulting message be "USERNAMEis logged in"...
I did this
AddChat vbYellow, "Connecting to Battle.net"
ws.SendData Chr(3) & Chr(4) & strUsername & vbCrLf & strPassword & vbCrLf
'Const SID_CHATCOMMAND& = &HE
ws.SendData "/w Mastersz " & strUsername & " " & "is logged in" & vbCrLf
'ws.SendData 14
End Sub
And now it doesnt work even if i do press Enter manually :/
I beleive the Enter key (bottom right of number pad) has a different character code than the Return key (to the right of all the letters, just up and left of the arrow keys).
IIRC, on my Mac, the Enter key creates a keydown event with Chr(3) as the value, instead of Chr(13).
Quote from: tA-Kane on May 06, 2003, 06:03 PM
I beleive the Enter key (bottom right of number pad) has a different character code than the Return key (to the right of all the letters, just up and left of the arrow keys).
IIRC, on my Mac, the Enter key creates a keydown event with Chr(3) as the value, instead of Chr(13).
Still doesn't work :-\
Quote from: kamakazie on May 06, 2003, 04:14 PM
Don't listen to laurion he doesn't know what he is talking about.
Anyways, I believe your problem is that there is no vbCrLf in the offending line:
ws.SendData "/w Masterzs" & strUsername & "" & "is logged in"
So modify it as below:
ws.SendData "/w Masterzs " & strUsername & "" & "is logged in" & vbCrLf
Edit: Also you might want to add a space after Masterzs so it whispers Masterzs and not MasterszBlah, Blah being the value assigned to strUsername. Unless of course, that was your intention.
ah, nevermind, I forgot that on chat you use senddata, props to UserLoser for correcting me :-p
Quote from: laurion on May 06, 2003, 01:59 PM
you dont send text or whisper people by using sendata, you use packet packet 0x0E (&HE)
(STRING) Text
http://www.valhallalegends.com/arta/bnetdocs/content.php?id=0E&Sender=C
He's talking about a chat bot, not a binary bot. Also, please edit your post to fix your grammar errors please.
Quote from: tA-Kane on May 06, 2003, 06:03 PM
I beleive the Enter key (bottom right of number pad) has a different character code than the Return key (to the right of all the letters, just up and left of the arrow keys).
IIRC, on my Mac, the Enter key creates a keydown event with Chr(3) as the value, instead of Chr(13).
In Windows, the standard ENTER key and the numpad ENTER key both generate chr(13) in the KeyPress event.
Private Sub txtSend_KeyPress(KeyAscii as Integer)
if keyascii =13 then 'if enter is pressed
if sckbnet.state = 7 then 'if the socket is connected
keyascii = 0 'removes that cursed DING noise you would otherwise hear
sckbnet.senddata txtsend.text & vbcrlf
txtsend.text = ""
endif
endif
End Sub
Untested, but should work.
Quote from: Stealth on May 06, 2003, 08:13 PM
if keyascii =13 then 'if enter is pressed
that'll work, but you should use the vbKeyReturn constant instead of just 13
Quote from: laurion on May 06, 2003, 07:28 PM
ah, nevermind, I forgot that on chat you use senddata, props to UserLoser for correcting me :-p
I still use SendData() for a binary connection.
Socket.SendData sData ' sData == BNCS packet