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 


Have a code disable itself

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Flux.
Advanced Cheater
Reputation: 0

Joined: 10 Nov 2016
Posts: 88
Location: Another World - N5X2 106311411+2123518

PostPosted: Sun Mar 31, 2019 3:53 am    Post subject: Have a code disable itself Reply with quote

Hello, i am looking for a way to have a code disable itself after 5 seconds.

example -
press hotkey and code changes to
'movss [rax+20],xmm3' and enables the cheat

after 5 seconds code automatically reverts to
'movss [rax+20],xmm2'

Thank you for any help.
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 51

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Sun Mar 31, 2019 4:01 am    Post subject: Reply with quote

Write the code injection and with Lua store the "memrec" variable then create a timer and when that times out just use "{saved memory record}.Active = false".

https://wiki.cheatengine.org/index.php?title=Tutorials:Lua:Basics
https://wiki.cheatengine.org/index.php?title=Lua:Class:Timer

_________________
Back to top
View user's profile Send private message Visit poster's website
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Sun Mar 31, 2019 4:05 am    Post subject: Reply with quote

Add this code to your AA script enable section:
Code:

{$lua}
if syntaxcheck then return end

local t=createTimer()
t.Interval=5000
t.OnTimer=function()
  memrec.Active=false
  t.destroy()
end
{$asm}

_________________
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
Flux.
Advanced Cheater
Reputation: 0

Joined: 10 Nov 2016
Posts: 88
Location: Another World - N5X2 106311411+2123518

PostPosted: Sun Mar 31, 2019 4:37 am    Post subject: Reply with quote

Thanks for the help TheyCallMeTim13, have made the table and going to give it a full test.

And thanks Dark Byte, missed your post initially.

Just a quick question,
If a hot key is assigned and you push it say 3 or 5 times, multiple timers are created,
all looking to disable the cheat if enabled,
so is it possible to destroy and reset the timer on each hotkey press and cheat disable.
Not to important as the cheat functions fine as is, was Just wondering.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Sun Mar 31, 2019 6:51 am    Post subject: Reply with quote

instead of local t make it a global timer with a unique name
then in the script check if it exists, and if so, destroy and nil it

_________________
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