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 


Help to fix interval timer value

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Thu Apr 30, 2015 1:51 am    Post subject: Help to fix interval timer value Reply with quote

Hi, guys

I try to make a speed hack trainer with timer.
The idea is user allow to input how long count down timer he/she want
and speed hack automatic return value 1 while count down time complete.
Speed hack work when click the button (its set to 0), but not return automatic to 1 when interval time over.

Does anyone can help to fix this script below ?


Code:

--- control_setCaption(CEEdit1, "0")

 
function CEButton1Click(sender)
 speedhack_setSpeed(0)
 t.Enabled=true
end

function resetSpeed()
  if (t) then
       t.Enabled=false
    -- t.Destroy()
    -- t=nil
  end
    speedhack_setSpeed(1)
end

t=createTimer(nil, false)
t.onTimer=resetSpeed
---tmr = tonumber(control_getCaption(UDF1.CEEdit1))
t.Interval=tonumber(control_getCaption(UDF1.CEEdit1))


Thanks



Capture.JPG
 Description:
 Filesize:  30.61 KB
 Viewed:  4876 Time(s)

Capture.JPG


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: Thu Apr 30, 2015 4:28 am    Post subject: Reply with quote

when the script launches the editbox contains the value 0
an interval of 0 will prevent the timer from functioning

what you want to do is set the interval in the button click before enabling it instead of when the script gets loaded

_________________
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
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Thu Apr 30, 2015 7:59 am    Post subject: Reply with quote

Thank you Dark Byte,

By follow your instruction, now the script work properly.

Edit script

Code:

function CEButton1Click(sender)
 tmr = tonumber(control_getCaption(UDF1.CEEdit1))
 t.Interval=tmr
 speedhack_setSpeed(0)
 t.Enabled=true
end

function resetSpeed()
  if (t) then
       t.Enabled=false
    -- t.Destroy()
    -- t=nil
  end
    speedhack_setSpeed(1)
end

t=createTimer(nil, false)
t.onTimer=resetSpeed


Be regards



Capture.JPG
 Description:
 Filesize:  32.86 KB
 Viewed:  4833 Time(s)

Capture.JPG


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 Lua Scripting 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