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 


Simulating keystrokes in DirectX games

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

Joined: 10 Jun 2016
Posts: 25

PostPosted: Thu Jan 05, 2017 7:08 pm    Post subject: Simulating keystrokes in DirectX games Reply with quote

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 Razz
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