Loop theard lua

Want Cheat Engine to do something specific and no idea how to do that, ask here. (From simple scripts to full trainers and extensions)
Post Reply
coroco
Noobzor
Noobzor
Posts: 10
Joined: Wed Jul 28, 2021 4:01 pm
Reputation: 0

Loop theard lua

Post 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

GreenHouse
Expert Cheater
Expert Cheater
Posts: 857
Joined: Fri Oct 12, 2018 10:25 pm
Reputation: 889

Re: Loop theard lua

Post 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.

ShyTwig16
Expert Cheater
Expert Cheater
Posts: 335
Joined: Thu Apr 06, 2017 7:14 pm
Reputation: 19

Re: Loop theard lua

Post 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.

Post Reply

Who is online

Users browsing this forum: No registered users