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 


Problem using Sleep. What else can I use?

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

Joined: 15 Dec 2016
Posts: 31

PostPosted: Tue Apr 09, 2019 9:35 am    Post subject: Problem using Sleep. What else can I use? Reply with quote

I've notice that while using Sleep it can sometimes prevent the line of code before it from running Which breaks the script.

So If I issue a command in my code. Then have it sleep right after on the next line. Since Sleep stops the script from running while it sleeps. The command may not have finished doing what its suppose to do before the script goes to sleep. Which then breaks things.

What other options can I use to have my script wait without going to sleep? Thanks!
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Tue Apr 09, 2019 9:40 am    Post subject: Re: Problem using Sleep. What else can I use? Reply with quote

AmyGrrl wrote:
I've notice that while using Sleep it can sometimes prevent the line of code before it from running Which breaks the script.

So If I issue a command in my code. Then have it sleep right after on the next line. Since Sleep stops the script from running while it sleeps. The command may not have finished doing what its suppose to do before the script goes to sleep. Which then breaks things.

What other options can I use to have my script wait without going to sleep? Thanks!


Try a timer or a thread. I gave an example at https://forum.cheatengine.org/viewtopic.php?p=5747424#5747424

What thing are you waiting for anyhow? A memoryscan? Some event in the target ?

_________________
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
Lynxz Gaming
Expert Cheater
Reputation: 4

Joined: 01 Jul 2017
Posts: 208
Location: help

PostPosted: Wed Apr 10, 2019 2:26 am    Post subject: Re: Problem using Sleep. What else can I use? Reply with quote

u can use
Code:
function ok()
print("hi")
sleep(100)
print("ok")
end
createNativeThread(ok)

_________________
my english is bad
discord : rynx#9828
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
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