Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


need help to submit one key to the gameWindow

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
BenBo
Newbie cheater
Reputation: 0

Joined: 03 Sep 2015
Posts: 13

PostPosted: Tue Apr 26, 2016 12:56 am    Post subject: need help to submit one key to the gameWindow Reply with quote

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
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4289

PostPosted: Tue Apr 26, 2016 8:35 am    Post subject: Reply with quote

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
View user's profile Send private message
BenBo
Newbie cheater
Reputation: 0

Joined: 03 Sep 2015
Posts: 13

PostPosted: Tue Apr 26, 2016 10:41 am    Post subject: Reply with quote

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
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4289

PostPosted: Tue Apr 26, 2016 10:46 am    Post subject: Reply with quote

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
View user's profile Send private message
BenBo
Newbie cheater
Reputation: 0

Joined: 03 Sep 2015
Posts: 13

PostPosted: Tue Apr 26, 2016 12:04 pm    Post subject: Reply with quote

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
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4289

PostPosted: Tue Apr 26, 2016 12:13 pm    Post subject: Reply with quote

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
View user's profile Send private message
zakalla
Newbie cheater
Reputation: 0

Joined: 10 May 2015
Posts: 15

PostPosted: Thu Apr 28, 2016 6:11 pm    Post subject: Reply with quote

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
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Fri Apr 29, 2016 4:57 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites