Posted: Thu Nov 20, 2014 12:20 am Post subject: Lua - how do you check the state of a key press each 'frame'
I want to set a value in memory like this:
Code:
if X key was just pressed
set a = 0
if X key was just released
set a = 1
also is there just a way in lua that you can have a function that doesn't require a hotkey to run, as in its just called every frame no matter if there is a button pressed down or not?
Joined: 25 Jan 2006 Posts: 8516 Location: 127.0.0.1
Posted: Thu Nov 20, 2014 1:21 am Post subject:
Cheat Engine offers the following key functions:
Code:
isKeyPressed(key) : returns true if the specified key is currently pressed
keyDown(key) : causes the key to go into down state
keyUp(key) :causes the key to go up
doKeyPress(key) : simmulates a key press
With that, you could create a timer and keep checking isKeyPressed. You can store the state of the key to determine if it is up/down to monitor for pressed and released like you want too. _________________
isKeyPressed(key) : returns true if the specified key is currently pressed
keyDown(key) : causes the key to go into down state
keyUp(key) :causes the key to go up
doKeyPress(key) : simmulates a key press
With that, you could create a timer and keep checking isKeyPressed. You can store the state of the key to determine if it is up/down to monitor for pressed and released like you want too.
I was unaware of "Timer" thank you this works perfectly
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