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 


Lua timer

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions
View previous topic :: View next topic  
Author Message
Lorizzuoso
Cheater
Reputation: 0

Joined: 09 Apr 2022
Posts: 27

PostPosted: Mon Apr 11, 2022 1:33 pm    Post subject: Lua timer Reply with quote

Hi,i created two scripts for two addresses that keep adding a value every tick and they work but the problem is that when i try to enable them both their values will keep going up without stopping,even if i disable them.
This only happens when i activate them both.

This is the code(is the same for both addresses):

[ENABLE]
{$lua}
timer1 = createTimer(nil, false)
timer1.Interval = 2
timer1.Enabled = true
timer1.OnTimer = function(timer)
writeFloat(0x209EC20C,readFloat(0x209EC20C)+0.6)
end
{$asm}

[DISABLE]
{$lua}
timer1.Enabled = false
writeFloat(0x209EC20C,0)
{$asm}
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1251

PostPosted: Mon Apr 11, 2022 1:44 pm    Post subject: Reply with quote

Make sure you don't name the scripts the same timer.
Code:
[ENABLE]
{$lua}
timer1 = createTimer(nil, false)
timer1.Interval = 2
timer1.Enabled = true
timer1.OnTimer = function(timer)
writeFloat(0x209EC20C,readFloat(0x209EC20C)+0.6)
end
{$asm}

[DISABLE]
{$lua}
if timer1 then timer1.Destroy() timer1=nil end
writeFloat(0x209EC20C,0)

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Lorizzuoso
Cheater
Reputation: 0

Joined: 09 Apr 2022
Posts: 27

PostPosted: Mon Apr 11, 2022 2:00 pm    Post subject: Lua timer Reply with quote

Thanks man,it works now!Btw nice pfp Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions 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