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 


OS.CLOCK usage

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Meiyoh
Master Cheater
Reputation: 1

Joined: 14 Mar 2015
Posts: 405

PostPosted: Sun Aug 09, 2020 2:20 am    Post subject: OS.CLOCK usage Reply with quote

Since i cant find any info about os.clock that can help i need to see if it can be used to say delay an execution

Like

if readInteger("SOMEADDR2)==1
then
Delay with os.clock() like half a second
and then
writeInteger("SomeAddres2",XXXX)

Can someone show me example of os.clock usage for such a task?

I will be very grateful.

_________________
I am the forgotten one the dead one.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 472

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

PostPosted: Sun Aug 09, 2020 3:01 am    Post subject: Reply with quote

Code:

sleep(500)
writeInteger("SomeAddress2",XXXX)


or
Code:

createTimer(500, function() writeInteger("SomeAddress2",XXXX) end


or if you insist:
Code:

local starttime=os.clock()
while os.clock()<starttime+0.5 do end
writeInteger("SomeAddres2",XXXX)

_________________
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
Meiyoh
Master Cheater
Reputation: 1

Joined: 14 Mar 2015
Posts: 405

PostPosted: Sun Aug 09, 2020 3:37 am    Post subject: Reply with quote

Dark Byte wrote:
Code:

sleep(500)
writeInteger("SomeAddress2",XXXX)


or
Code:

createTimer(500, function() writeInteger("SomeAddress2",XXXX) end


or if you insist:
Code:

local starttime=os.clock()
while os.clock()<starttime+0.5 do end
writeInteger("SomeAddres2",XXXX)


THATS GOLD! THANK YOU ERIC! Much appreciated . Pure gold . Couldnt find proper info in the 4th lua edition book but what i expect when i search for stuff that i havent reached yet but need to do... Thanks again Smile

seems like i need to declare first starttime and then the os.clock() and then starttime is basically the "counter " + 0.5 = half a second and then execute.

i see now. will try some experimenting with os.clock then Smile

_________________
I am the forgotten one the dead one.
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