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 


Changing a value based on a timer

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
trifidix
Newbie cheater
Reputation: 0

Joined: 11 May 2022
Posts: 16

PostPosted: Wed May 11, 2022 9:10 pm    Post subject: Changing a value based on a timer Reply with quote

I have a timer and another address, I need to change the value of the address based on the timer along with some conditions, something along the lines of:

Code:

if (timer % 15 == 0):
    address = 10


I need this code to be active/toggleable at all times, I thought of using the built in LUA to do it, but I have no idea how to do so... any explanation on how to do this, or some tutorial so I don't have to read the entire CE wiki?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4702

PostPosted: Wed May 11, 2022 9:18 pm    Post subject: Reply with quote

I don't know what you mean by modulo 15. You can change the interval directly:
Code:
if mytimer then mytimer.destroy(); mytimer = nil end

mytimer = createTimer()
mytimer.Interval = 15000  -- 15 seconds
mytimer.OnTimer = function(t)
  writeInteger(address, 10)
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
trifidix
Newbie cheater
Reputation: 0

Joined: 11 May 2022
Posts: 16

PostPosted: Wed May 11, 2022 9:25 pm    Post subject: Reply with quote

I'm asking how to make my own code run in CE, via LUA if that's even possible... like, a step by step guide on what to click essentially.

The example code being a rough example of what I need to implement (I chose the python syntax for a reason).
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4702

PostPosted: Wed May 11, 2022 9:50 pm    Post subject: Reply with quote

Table -> Show Cheat Table Lua Script, copy/paste that code, change the address, and click Execute script

If you want to do this yourself, learn the Lua language first and then learn the stuff CE adds to Lua (createTimer, writeInteger...)

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