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 


Send a keypress with Lua

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
acg44
How do I cheat?
Reputation: 0

Joined: 05 Feb 2012
Posts: 5

PostPosted: Sun Feb 05, 2012 4:26 pm    Post subject: Send a keypress with Lua Reply with quote

I am trying to send a keypress with Lua script. I searced a lot but I couldnt find any way to do it. Please someone help me.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Sun Feb 05, 2012 6:10 pm    Post subject: Reply with quote

Code:



s="BLA" --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)

The following script will constantly type "bla"

The current implementation will require you to close CE when you want it to stop, but if you wish you could create a button to click which destroys the timer using object_destroy(t)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
acg44
How do I cheat?
Reputation: 0

Joined: 05 Feb 2012
Posts: 5

PostPosted: Mon Feb 06, 2012 8:15 am    Post subject: Reply with quote

Pressing a key is working well. It is running everywhere except my game. I couldn't send it while I am game.
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