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 


Can someone give me an example

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

Joined: 10 Jul 2014
Posts: 5

PostPosted: Tue May 24, 2016 5:13 pm    Post subject: Can someone give me an example Reply with quote

can someone give me an example of Lua code that would read the memory address of my health in a game and when it drops below, let's say 25, it pushes H which in this case uses a med kit
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4289

PostPosted: Tue May 24, 2016 5:46 pm    Post subject: Reply with quote

Code:
if readInteger(0x1234ABCD) == 25 then
  doKeyPress(VK_H)
end


If you'd like it to run continuously, embed it inside a timer:
Code:
t = createTimer()
t.Interval = 100
t.OnTimer = function(sender)
  if readInteger(0x1234ABCD) == 25 then
    doKeyPress(VK_H)
  end
end

_________________
I don't know where I'm going, but I'll figure it out when I get there.
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