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 


Lua timer not activating

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
MuckySpud
How do I cheat?
Reputation: 0

Joined: 06 Jun 2020
Posts: 8

PostPosted: Mon Feb 06, 2023 6:59 am    Post subject: Lua timer not activating Reply with quote

Hey guys, I am running into a strange issue with a lua script not activating the timer I am setting. I have included a screenshot of my simple test script along with the lua engine output to show only part of the code is being activated.

The strange thing is that if I go into the lua engine itself and paste the code in and execute it manually, the timer works flawlessly and will print the text "Timer activated" every 3 seconds. However when I run it from a script on the table itself by activating the check box, only the start of the code will work while the timer remains idle.

I was able to enable hotkeys to enable and disable the timer and disabling and re-enabling the timer kick starts the timer but surely there is a reason behind the script not activating the timer from the cheat table but working flawlessly from the lua engine itself?

Any help would be appreciated, thanks.



0241084698502c7bd30626b7f8b0d562.png
 Description:
 Filesize:  13.13 KB
 Viewed:  918 Time(s)

0241084698502c7bd30626b7f8b0d562.png


Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25296
Location: The netherlands

PostPosted: Mon Feb 06, 2023 7:40 am    Post subject: Reply with quote

Code:

timer.Enabled=true

_________________
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
MuckySpud
How do I cheat?
Reputation: 0

Joined: 06 Jun 2020
Posts: 8

PostPosted: Mon Feb 06, 2023 7:43 am    Post subject: Reply with quote

Dark Byte wrote:
Code:

timer.Enabled=true


I had added that in before and it didnt seem to make a difference, so I have tried it again and still have the same issue. Unless I am putting it in the wrong place or using it wrong?



timer.png
 Description:
 Filesize:  15.41 KB
 Viewed:  898 Time(s)

timer.png


Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25296
Location: The netherlands

PostPosted: Mon Feb 06, 2023 7:49 am    Post subject: Reply with quote

try just createTimer() without parameters
_________________
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
MuckySpud
How do I cheat?
Reputation: 0

Joined: 06 Jun 2020
Posts: 8

PostPosted: Mon Feb 06, 2023 8:00 am    Post subject: Reply with quote

Dark Byte wrote:
try just createTimer() without parameters


Still no joy, I am thinking its something to do with activating it from an auto assemble script as when I paste in the exact same code into the engine itself you can see from the screenshot that it kicks in just fine whereas at the top of the output you can see it never says "Timer activated"


Edit: Resolved the issue, I created an entirely new auto assembly entry in my table and the code worked even though it was the exact same code pasted in so I dug into it further and copied the entire table entry into notepad++ and compared the two.

The culprit was this line - <AssemblerScript Async="1">{$lua}

When on the working table entry it was this instead - <AssemblerScript>{$lua}

When checking back to my auto assembly script I found that when I right clicked it, it had an option called execute asynchronous enabled, no idea how this was enabled but disabling it has completely fixed the issue with the timer now.



timer2.png
 Description:
 Filesize:  26.83 KB
 Viewed:  883 Time(s)

timer2.png


Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4300

PostPosted: Mon Feb 06, 2023 2:35 pm    Post subject: Reply with quote

Timers are similar to the GUI in that you should only touch them from the main thread. "Execute asynchronous" runs {$lua} blocks in a separate thread. Use `synchronize` or other means if you must do such work from a separate thread.

Also, put "if syntaxcheck then return end" at the top of {$lua} blocks.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
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 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