View previous topic :: View next topic |
Author |
Message |
Jesuszilla Newbie cheater Reputation: 0
Joined: 29 Jul 2015 Posts: 11
|
Posted: Wed Jul 29, 2015 6:53 pm Post subject: Timer only fires once |
|
|
Hello! I'm completely new to CheatEngine (been an ArtMoney user for many, many years), and I absolutely LOVE the idea of the scripting engine and it's the first thing I started playing around with once I transferred over some ArtMoney values.
Anyway, introductions out of the way, I have a form which I want to use to display the character velocity in a textbox. I want it to be updated every few milliseconds, so I added a Timer from the form creator to the form. Enabled is set to true, and I have an OnTimer event assigned. The only problem is, it fires exactly once, and never again.
Is there some specific way I need to run the form, or is my timer somehow being garbage collected?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Thu Jul 30, 2015 3:19 am Post subject: |
|
|
when designing/testing the form make sure you first execute the lua script else the old function will be called instead
also, what does your onTimer do? Destroy sender/timer? Change the interval?
_________________
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 |
|
|
Jesuszilla Newbie cheater Reputation: 0
Joined: 29 Jul 2015 Posts: 11
|
Posted: Thu Jul 30, 2015 12:37 pm Post subject: |
|
|
How do I make sure the LUA script executes before the form?
Also the timer calls a method that updates the text in two Edit boxes. ReadOnly is set to false, so it should update (and indeed does, the first time).
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Thu Jul 30, 2015 1:29 pm Post subject: |
|
|
you can just click on execute in the lua script window before you start testing things
Instead of editing a editbox try the print command to verify that the timer only runs once. (it could just as well be that the code to set the editbox doesn't work a second time for some weird reason, like focused, or you have an if that checks if it's empty, etc...)
_________________
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 |
|
|
Jesuszilla Newbie cheater Reputation: 0
Joined: 29 Jul 2015 Posts: 11
|
Posted: Thu Jul 30, 2015 8:32 pm Post subject: |
|
|
Thanks for the help! I found the problem― my function wasn't set up correctly. I should have had "sender" as a parameter to my update_velocities function that the timer was calling.
Though now I can't get the timer to stop when I click the button again. My function for start_timer() is as follows:
Code: | function start_timer(sender)
if timer_getEnabled(velocityTimer) == false then
timer_setEnabled(velocityTimer,true)
else
timer_setEnabled(velocityTimer,false)
end
end |
This starts the timer, yet it does not stop it.
Also, I may be getting ahead of myself here, but speaking of "sender," is it possible to get a set of objects from the sender parameter?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Fri Jul 31, 2015 3:50 am Post subject: |
|
|
try
Code: |
velocityTimer.Enabled=not velocityTimer.Enabled
|
and you don't have another timer running? (e.g. if you create a timer with code instead of forms, you'll have to destroy it yourself)
not sure what you mean with "a set of objects" but closest thing i can come up with is use a table with a set of objects, use createRef to get in integer reference to that table, assign it to the Tag property, and then in the functioncall use getRef with Sender.Tag to get the table containg the objects
_________________
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 |
|
|
Jesuszilla Newbie cheater Reputation: 0
Joined: 29 Jul 2015 Posts: 11
|
Posted: Sun Aug 02, 2015 4:27 pm Post subject: |
|
|
Works now! I guess the form was out of sync with the LUA script.
I'm getting the hang of this pretty quickly! Once again, this is an AWESOME tool, thanks!
|
|
Back to top |
|
|
|