View previous topic :: View next topic |
Author |
Message |
Woza Newbie cheater Reputation: 0
Joined: 08 Sep 2012 Posts: 12
|
Posted: Sun Sep 08, 2013 5:13 am Post subject: How do timers work? |
|
|
Code: | form = createFormFromFile("Form.FRM")
form_show(form)
t = createTimer(nil) -- Why pass nil as a parameter, is it important?
timer_onTimer(t, printasd)
timer_setInterval(t,3000)
timer_setEnabled(t, false)
function toggle(sender)
if (control_getCaption() == 1) then
timer_setEnabled(t, true)
else
timer_setEnabled(t, false)
end
end
function printasd()
print("asd")
end |
Changing a checkbox that calls toggle() crashes CE and prints "Error: Invalid class object". Also what does the argument to createTimer() mean?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Sun Sep 08, 2013 5:27 am Post subject: |
|
|
control_getCaption() needs as parameter an object that inherits from the Control Class and it returns a string
If you are using 6.3 you can use this code:
Code: |
function toggle(sender)
t.Enabled=sender.Checked
end
|
if you're using 6.2 or earlier then use this:
Code: |
if (checkbox_getState(sender)==cbChecked) then
timer_setEnabled(t, true)
else
timer_setEnabled(t, false)
end
|
the parameter passed to createTimer is the owner. If the owner gets destroyed, the timer gets automatically destroyed as well
_________________
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 |
|
|
|