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 


Timer in Lua script.
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Wed Aug 23, 2017 4:50 pm    Post subject: Reply with quote

I don't suppose you're using the same name for the other timer?

It should be running, though it may just print an error like Error:Failure determining what [_stamms]+58 means (_stamms not defined) or Error:[string "local syntaxcheck,memrec=...
..."]:8: attempt to index a nil value
(record with name '_stamms + 58' does not exist)...

If nothing else try running the lua code in the lua engine window instead of an AA script to verify that it works as expected there.
Back to top
View user's profile Send private message
Zec
Newbie cheater
Reputation: 0

Joined: 02 Jul 2016
Posts: 17

PostPosted: Sat Aug 26, 2017 3:51 am    Post subject: Reply with quote

Thanks for helping.

When I activate my first AA script, _stamms is registered and works...

I changed my 2nd script to your suggestions and it runs in the lua engine and prints:

Quote:
tHolz ping
writeInteger address in decimal 2729195960
mem rec object address in decimal 021FCDF0


the memory address is being updated as planned. dec 2729195960 is correct.

the same code as a table entry does not work and also does not result in any lua output.

i used tHolz only for this timer name and fHolz only for this function.

my whole CT file is here, maybe you could take a look into it?

h**ps://paste.ee/p/3bwam (i am not allowed to post urls and also CTs should not be uploaded... please replace * with t.
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Sat Aug 26, 2017 9:24 am    Post subject: Reply with quote

ah, it's marked as asynchronous. I remember a forum topic that mentioned that timers in asynchronous scripts don't ever get run for some reason, you should be able to use a thread however if there is some reason for that to be asynchronous.

quick example:
Code:
{$lua}
[ENABLE]
if syntaxCheck then return end
thethread = createThread(function(Thread)
  while true do
    if Thread.Terminated then break end -- breaks loops and allows function to end
    sleep(500) -- interval
    print(('%s %i says: hi!!!!'):format(os.clock(), memrec.id))
  end
end)

[DISABLE]
thethread.terminate()
Back to top
View user's profile Send private message
Zec
Newbie cheater
Reputation: 0

Joined: 02 Jul 2016
Posts: 17

PostPosted: Mon Aug 28, 2017 1:18 pm    Post subject: Reply with quote

OMG, now it works! Thanks a lot. I would never thought that the asynchronous flag would have this side effect.

Thanks thanks thanks!
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 Lua Scripting All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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