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 


when an instruction is accessed, Do my own code?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
stinkycheeks69
How do I cheat?
Reputation: 1

Joined: 13 Mar 2022
Posts: 6
Location: Your Mum

PostPosted: Sun Jul 24, 2022 4:10 pm    Post subject: when an instruction is accessed, Do my own code? Reply with quote

I want it so when a certain piece of code is executed it will also do:

{$lua}
print("hi")

basically the instruction is only accessed in a certain scenario (when the player is dead) and I want to execute my own code when this happens.

any examples would be great! :)
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1053
Location: 0x90

PostPosted: Sun Jul 24, 2022 4:29 pm    Post subject: Reply with quote

You will most likely have to monitor the health value then implement logic based on that health value:
Code:

if checkHealth then checkHealth.destroy() end

checkHealth = createTimer(getMainForm())
checkHealth.Interval = 50
checkHealth.OnTimer = function()
local health = readFloat('address_of_health')
   if health ~= nil and health == 0 then
      print('Player is dead')
   end
end
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 Jul 24, 2022 5:30 pm    Post subject: This post has 1 review(s) Reply with quote

example if you want to print hi whenever the value at rax+210 < 50:

Code:

cmp [rax+210],#50
ja notbelow

{$luacode}
synchronize(function() --not needed for print, but it's easier for newbies this way
  print("hi")
end)
{$asm}

notbelow:
//normal operation

_________________
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
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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