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 


While condition

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

Joined: 22 Jun 2021
Posts: 489
Location: mov dword ptr [Ukraine]

PostPosted: Sat Jul 24, 2021 2:00 pm    Post subject: While condition Reply with quote

Code:
while stop == 0 do
print("Test");
if isKeyPressed(VK_ESCAPE) then
stop = 1
break
end
sleep(100)
end

If i don't stop this in lua engine, CE will freeze
And if i write a simple lua script


Last edited by Frouk on Sat Jul 24, 2021 2:07 pm; edited 1 time in total
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Sat Jul 24, 2021 2:06 pm    Post subject: Reply with quote

You're putting the main thread in an infinite loop. You should use a thread or timer.
_________________
Back to top
View user's profile Send private message Visit poster's website
Frouk
Master Cheater
Reputation: 5

Joined: 22 Jun 2021
Posts: 489
Location: mov dword ptr [Ukraine]

PostPosted: Sat Jul 24, 2021 2:07 pm    Post subject: Reply with quote

Is there's way to avoid this?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Sat Jul 24, 2021 2:15 pm    Post subject: Reply with quote

yes, don't use infinite while loops in the main thread. Always stop them
_________________
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
Frouk
Master Cheater
Reputation: 5

Joined: 22 Jun 2021
Posts: 489
Location: mov dword ptr [Ukraine]

PostPosted: Sat Jul 24, 2021 2:24 pm    Post subject: Reply with quote

Creating new thread will avoid this crash?

P.S: Got an idea to make function OnUpdate (kinda)
Back to top
View user's profile Send private message
ByTransient
Expert Cheater
Reputation: 5

Joined: 05 Sep 2020
Posts: 240

PostPosted: Sat Jul 24, 2021 3:05 pm    Post subject: Reply with quote

A similar topic has been covered recently.
Check out the solutions;

https://forum.cheatengine.org/viewtopic.php?p=5772278#5772278
Back to top
View user's profile Send private message
Frouk
Master Cheater
Reputation: 5

Joined: 22 Jun 2021
Posts: 489
Location: mov dword ptr [Ukraine]

PostPosted: Sat Jul 24, 2021 11:47 pm    Post subject: Reply with quote

New thread require an address, what to do?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Sun Jul 25, 2021 12:38 am    Post subject: Reply with quote

use lua createThread not Autoassembler CreateThread

it takes a function

_________________
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
Frouk
Master Cheater
Reputation: 5

Joined: 22 Jun 2021
Posts: 489
Location: mov dword ptr [Ukraine]

PostPosted: Sun Jul 25, 2021 11:01 am    Post subject: Reply with quote

Thanks for help
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