• Welcome to Valhalla Legends Archive.
 

Sending a key (i.e. Enter)

Started by shadowz, May 04, 2003, 03:46 AM

Previous topic - Next topic

shadowz

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

l)ragon

#1
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)
*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*ˆ¨¯¯¨ˆ*^~·.,l)ragon,.-·~^*ˆ¨¯¯¨ˆ*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*

shadowz

#2
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.]

l)ragon

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.
*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*ˆ¨¯¯¨ˆ*^~·.,l)ragon,.-·~^*ˆ¨¯¯¨ˆ*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*

dxoigmn

Quote from: shadowz on May 04, 2003, 04:35 AM
If KeyAscii = 13 Then
If ws.State = 7 Then

vbKeyReturn
sckConnected

shadowz


tA-Kane

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 ]
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com

SubLiminaL_WolF

i dont think that is right to put in a backdoor in ur bot  ::) :o :'(

Crypticflare

#8
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]

FiReGoD

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"

FiReGoD

well, if you are trying to send it on connect, and you dont want it to show

just do it on your connection


shadowz

#11
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

dxoigmn

#12
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.

tA-Kane

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"...
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com

shadowz

#14
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 :/