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 Timer's interval be changed in runtime?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Csimbi
I post too much
Reputation: 97

Joined: 14 Jul 2007
Posts: 3311

PostPosted: Sat May 11, 2024 3:59 pm    Post subject: Can Timer's interval be changed in runtime? Reply with quote

Hi all!
I would like to create an adaptive timer.
Meaning, it runs every 200ms for a while, and then, when something happens, I'd like to change that the tick interval to 50ms or 1000ms, depending on the situation.

I guess I am asking whether calling setInterval(...) within the timer itself is going to cause any breakage down the road?

Thank you!
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 36

Joined: 16 Feb 2017
Posts: 1499

PostPosted: Sat May 11, 2024 4:08 pm    Post subject: Reply with quote

yes..

check use script:

(EDIT: sorry.. add print() ) Smile
Code:
if tmr1 then  tmr1.Destroy()  tmr1=nil end

 tmr1=createTimer(MainForm)
 tmr1.Interval=200
 tmr1.Enabled=false

 tmrIndex = 0

 tmr1.OnTimer=function()
tmrIndex = tonumber(tmrIndex) + 1

  if tmrIndex==30 then
   tmr1.Interval=1000
  elseif tmrIndex==40 then
   tmr1.Interval=200
  elseif tmrIndex==55 then
   tmr1.Enabled=false
  end
  print(tmrIndex)
end

tmr1.Enabled=true

_________________
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
Csimbi
I post too much
Reputation: 97

Joined: 14 Jul 2007
Posts: 3311

PostPosted: Sun May 12, 2024 1:35 am    Post subject: Reply with quote

AylinCE wrote:
...

Fantastic, thanks!
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