Punz1A4 Cheater
Reputation: 0
Joined: 10 Jun 2016 Posts: 25
|
Posted: Thu Jan 05, 2017 7:08 pm Post subject: Simulating keystrokes in DirectX games |
|
|
I've been playing FFX recently and wanted to write a simple script that would spam a specific key on keyboard. Googled a bit and came across this:
| Code: | {$lua}
[ENABLE]
s="C" --must be uppercase
i=1;
m=0;
function typestring()
if ((m % 2)==0) then
keyDown(string.byte(s,i))
else
keyUp(string.byte(s,i))
i=i+1
if (i>#s) then
i=1
end
end
m=m+1
end
t=createTimer(nil)
timer_setInterval(t, 100)
timer_onTimer(t, typestring)
timer_setEnabled(t, true)
[DISABLE]
object_destroy(t) |
(Source:/viewtopic.php?t=547656)
The scripts works as intended in notepad and other text editors aswell as non-DirectX games (tested on openGL game Star Wars Jedi Knight II Jedi Outcast and everything worked fine).
Now I've read something 'bout DirectX not using default virtual key codes but I couldn't make a lot of sense of it.
Anybody knows if it's possible to go around this problem in cheat engine somehow?
EDIT:
So after digging into the topic a bit more it seems rather hard to achieve what i wanted in certain DirectX games.
If it helps anybody in the future, I managed to work around it by using TinyTask to manually record sequence of keypresses and then either looping the playback within the program itself or compiling the macro to .exe (function within the recording program) and then using shellExecute() function looped via timer in cheat engine.
Still, if anybody knows a way to do something like this without external program I'd love to find out how
|
|