0

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.

luther
  • 5,195
  • 1
  • 14
  • 24
terter99
  • 1
  • 1

1 Answers1

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