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 


How do I pause?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Roman012
!BEWARE! Deletes post on answer
Reputation: 0

Joined: 25 Dec 2022
Posts: 24

PostPosted: Mon Jan 09, 2023 9:38 am    Post subject: How do I pause? Reply with quote

I want line (getAddressList().getMemoryRecordByDescription('Pla').Active = true) to be executed
and then wait three seconds
and do the rest
how to do it?

[ENABLE]
{$lua}
getAddressList().getMemoryRecordByDescription('Pla').Active = true

-----Here I need to wait a couple of seconds-----???
getAddressList().getMemoryRecordByDescription('Sk').Value = "-161.9665222"
if syntaxcheck then return end
local t=createTimer()
t.Interval=500
t.OnTimer=function()
memrec.Active=false
t.destroy()
end
{$asm}
[DISABLE]
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1253

PostPosted: Mon Jan 09, 2023 9:57 am    Post subject: Reply with quote

Code:
[ENABLE]
{$lua}
if syntaxcheck then return end

if tmr1 then tmr1.Destroy() tmr1=nil end
local index1 = 0
tmr1 = createTimer()
tmr1.Interval = 500

tmr1.OnTimer=function()
index1 = tonumber(index1) + 1
getAddressList().getMemoryRecordByDescription('Pla').Active = true
-----Here I need to wait a couple of seconds-----???
 if index1==6 then -- 3 seconds
   getAddressList().getMemoryRecordByDescription('Sk').Value = "-161.9665222"
-- end
 --if index1==10 then -- 5 seconds
  getAddressList().getMemoryRecordByDescription('Pla').Active = false
 end
end

{$asm}
[DISABLE]

{$lua}
if tmr1 then tmr1.Destroy() tmr1=nil end

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Mon Jan 09, 2023 8:06 pm    Post subject: Reply with quote

Just make it simple. Add sleep() seconds, 1000 = 1 second, so

Code:
getAddressList().getMemoryRecordByDescription('Pla').Active = true
sleep(3000)
getAddressList().getMemoryRecordByDescription('Sk').Value = "-161.9665222"


Try this to get know how it work.

first script :

Code:
for i = 1, 10 do
 print(i)
end


Now, second script with sleep()

Code:
for i = 1, 10 do
sleep(3000)
print(i)
end


See the different.

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
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
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