Page 1 of 1

Loop theard lua

Posted: Wed Jul 28, 2021 4:10 pm
by coroco
I wanted to create a thread in a loop so I took the script formula from the forum, but even when I paste the clean code to cheat engine shows error about global atimer, what do I do? I would like the script to run in a loop after selecting active, and to stop when unchecked.
cheat engine 7.2
Image

Re: Loop theard lua

Posted: Wed Jul 28, 2021 6:36 pm
by GreenHouse
Remove "local aTimer = nil" and it'll work.

I'm not 100% sure of how it works, but the destroy is taking the local variable instead of the one that has the timer. I guess that local variables have priority over global ones when it's in the same script? So either remove the entire line, which pretty much does nothing to begin with, or remove the "local" from it.

Re: Loop theard lua

Posted: Wed Jul 28, 2021 10:04 pm
by ShyTwig16
Local variables worked if they were in the same script. But one of the CE updates seems to have changed this so now if you want access to a variable from the enable section in the disable section you need to make it global. Since you don't need it to be a local variable just delete the local variable declaration as GreenHouse said, because it makes it a local only accessible in the enable section.