View previous topic :: View next topic |
Author |
Message |
SomeoneElse123 Newbie cheater Reputation: 0
Joined: 30 Dec 2018 Posts: 11
|
Posted: Sat Jan 05, 2019 7:07 am Post subject: Pause in lua script |
|
|
Hi, I'm working on my lua script and I want to ask if ce offers any function how to inject a small pause to the script. It does one function, then does nothing for a second or two and then it does the next function. If anyone knows how to do that, please let me know |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25291 Location: The netherlands
|
Posted: Sat Jan 05, 2019 8:50 am Post subject: |
|
|
sleep(timeinmilliseconds) (best used in a thread)
or timer _________________
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 |
|
|
DaSpamer Grandmaster Cheater Supreme Reputation: 52
Joined: 13 Sep 2011 Posts: 1578
|
Posted: Sat Jan 05, 2019 12:17 pm Post subject: |
|
|
You could try running a loop while statement with calling processMessages() so cheat engine will respond at least, it can work but there will be much performance penalties.
I wrote an example of how to use threads (for this kind of actions - delayed actions).
It uses threads suspend and resume, which saves us lot's of cpu (better than using sleep function and especially for/while loops)
https://forum.cheatengine.org/viewtopic.php?p=5744228#5744228 _________________
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8517 Location: 127.0.0.1
|
Posted: Sat Jan 05, 2019 3:47 pm Post subject: |
|
|
Look into coroutines for Lua, this is what they are for. _________________
- Retired. |
|
Back to top |
|
|
Scorm Newbie cheater Reputation: 0
Joined: 06 Dec 2018 Posts: 11
|
Posted: Sun Jan 06, 2019 1:07 pm Post subject: |
|
|
atom0s is right, look into coroutines and yield() to have an effective solution that doesn't "do nothing for X seconds".
Otherwise, you might want to create a timer on a form with the desired wait time interval. |
|
Back to top |
|
|
|