View previous topic :: View next topic |
Author |
Message |
BenBo Newbie cheater Reputation: 0
Joined: 03 Sep 2015 Posts: 13
|
Posted: Tue Apr 26, 2016 12:56 am Post subject: need help to submit one key to the gameWindow |
|
|
not about hotkey.
I want do something about keyboard , e.g. press spaceBar to jump or VK_W to go along.
and i noticed that there are some functions in "main.lua", such as "doKeyPress()", "keyDown()" . but do not know how to use it. Can you paste any example here?
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Tue Apr 26, 2016 8:35 am Post subject: |
|
|
Code: | doKeyPress(VK_W) -- presses the 'w' key |
See defines.lua for all the key codes.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
BenBo Newbie cheater Reputation: 0
Joined: 03 Sep 2015 Posts: 13
|
Posted: Tue Apr 26, 2016 10:41 am Post subject: |
|
|
ParkourPenguin wrote: | Code: | doKeyPress(VK_W) -- presses the 'w' key |
See defines.lua for all the key codes. |
it doesn't do.
I tried to type words to a opend txt_file with "doKeyPress()" ,and saw nothing .
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Tue Apr 26, 2016 10:46 am Post subject: |
|
|
You're probably not doing it right.
Code: | hk = createHotkey(function() doKeyPress(VK_W) end, VK_Q) |
Run this code. Any time you press q, CE will press w as well.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
BenBo Newbie cheater Reputation: 0
Joined: 03 Sep 2015 Posts: 13
|
Posted: Tue Apr 26, 2016 12:04 pm Post subject: |
|
|
ParkourPenguin wrote: | You're probably not doing it right.
Code: | hk = createHotkey(function() doKeyPress(VK_W) end, VK_Q) |
Run this code. Any time you press q, CE will press w as well. |
thank you for the example.
yeh! i got it .
"doKeyPress(VK_W)" needs my gamewindow to be foreground , is it?
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Tue Apr 26, 2016 12:13 pm Post subject: |
|
|
Yes. If you're currently using one program and press some keys on the keyboard, not all actively running programs will respond to those key presses. That would be chaotic and senseless.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
zakalla Newbie cheater Reputation: 0
Joined: 10 May 2015 Posts: 15
|
Posted: Thu Apr 28, 2016 6:11 pm Post subject: |
|
|
ParkourPenguin wrote: | Yes. If you're currently using one program and press some keys on the keyboard, not all actively running programs will respond to those key presses. That would be chaotic and senseless. |
Making keys work in the background with a controller should be fine (as in most cases, games would be the only ones using a controller).
Finding the code for controller key inputs, though, is a different story.
|
|
Back to top |
|
|
++METHOS I post too much Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Fri Apr 29, 2016 4:57 am Post subject: |
|
|
zakalla wrote: | Finding the code for controller key inputs, though, is a different story. | -It's as easy as finding anything else. If you want to be able to send input while the target isn't in focus, you'll have to search for those values with that in mind.
|
|
Back to top |
|
|
|