• Welcome to Valhalla Legends Archive.
 

KeyPress

Started by Yegg, November 09, 2004, 03:20 PM

Previous topic - Next topic

Dyndrilliac

Something I just noticed.

You do realize you have to add your own message to the chat window, since sending a message does not call the UserTalk Event, correct? The message is being sent but you aren't adding the text you sent to your RichTextBox (If that's what you're using).

Quote from: Edsger W. DijkstraIt is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.

Yegg

i know this! and im not worried about adding the chat yet, i just couldn't get the bot to send message by pressing enter, while im using the same code on another bot of mine and it works. and i have "13 instead of 13. this bot im working on now just wont send message by pressing enter, instead it will send them if i press shift and enter at the same time.

TheMinistered


Private Sub txtSend_KeyPress(KeyAscii As Integer)
   
    If (KeyAscii = vbKeyReturn) Then
        If (LenB(txtSend.Text) <> 0) Then
            pbuffer.InsertNTString txtSend.Text
            pbuffer.sendPacket &HE
           
            txtSend.Text = vbNullString
           
            KeyAscii = 0
        End If
    End If
   
End Sub


This code should work correctly, if it still isn't sending your message to battle.net-- then you should be slapped.  Why?  Because if it still isn't then it's OBVIOUSLY a problem with your packet buffer!

The-FooL

Quote from: Yegg on November 13, 2004, 07:16 PM
i know this! and im not worried about adding the chat yet, i just couldn't get the bot to send message by pressing enter, while im using the same code on another bot of mine and it works. and i have "13 instead of 13. this bot im working on now just wont send message by pressing enter, instead it will send them if i press shift and enter at the same time.

Try using keydown instead?

Yegg

ok, sorry for not reading this thread in a while but i found out that theres nothing wrong with the packetbuffer, it wus the keypress part, so ima go with the code TheMinistered showed and see how this works out, if it doesn't work then.......i think i've tried everything.

LivedKrad

Ahh *makes note of TM's use of constants*. I love constants, they are so much prettier than their integer/string counterparts! Assuming the functions for adding items into the buffer match what TM has, it should work fine. Yet, if you have used people's code and not taken into account that there are function name inconsistencies, (ie: NOT THE SAME FUNCTION), then you should be slapped.