Is it possible to hold down a key in lua, for example 'a'? I don't mean pressing the key with doKeyPress(VK_A) and then looping it but actually holding it for a certain amount of time.
Asked
Active
Viewed 1,436 times
0
-
If possible, please add a tag for the library or framework you're using. `doKeyPress` is not part of standard Lua. – luther Nov 01 '20 at 02:13
-
I use Lua Engine in Cheat Engine. – terter99 Nov 01 '20 at 02:18
-
There is a tag for that. I've added it. – luther Nov 01 '20 at 02:29
1 Answers
0
What you want is keyDown()
instead.
https://wiki.cheatengine.org/index.php?title=Lua:keyDown
You'll eventually want to do a keyUp()
command to release it.
https://wiki.cheatengine.org/index.php?title=Lua:keyUp
Either by triggering an event (a key or mouse click of your own)
or by using a timer to keyUp() after a specified time.
Edit:
https://wiki.cheatengine.org/index.php?title=Lua:sleep
keyDown( VK_A )
Sleep( 5000 )
keyUp( VK_A )

Doyousketch2
- 2,060
- 1
- 11
- 11
-
local timeAdress = '[[[[[[["TmForever.exe"+00966E1C]+48]+A4]+1B4]+0]+238]+1C]+2B0' local timer = readInteger(timeAdress) I found out the pointer of the timer in the game. My plan is to tell the programm: If the timer is 0 then press button 'w' for 5000 milliseconds. So after the timer reaches 5000 milliseconds, it should release the key again. But i can't make it work. I tried keyDown() and keyUp() but with no success. – terter99 Nov 01 '20 at 03:25