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 


Need help with createHotkey

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
rakion99
How do I cheat?
Reputation: 0

Joined: 31 Oct 2016
Posts: 1
Location: Mexico

PostPosted: Mon Oct 31, 2016 2:21 am    Post subject: Need help with createHotkey Reply with quote

why when i call a function with a hotkey and in the function i have a createhotkey cheat engine stop responding? if i call the function with a button is fine but if i use a hotkey this happen, im doing something wrong?
Code:

print ("Loaded")
function CEButton1Click()
print("Start")--Here Cheat Engine Stop Responding
createHotkey(setFlyOn, VK_SPACE)
print("End")
end

createHotkey(CEButton1Click,VK_NUMPAD9)


Thanks :3
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Mon Oct 31, 2016 2:55 am    Post subject: Reply with quote

the hotkey handler has a critical section while it's handling the hotkeys. (it runs in a separate thread but sends of the hotkey functions to the main thread and wait for them to return)
createHotkey will acquire that critical section, when it adds a new entry to that list.

Therefore, calling createHotkey will wait till the hotkeyhandler has finished an interation, and the hotkley handler is waiting for the current hotkey to finish, so, deadlock

What you can do instead is spawn a timer which you disable as soon as it runs (or spawn a thread that does this)

_________________
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
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Mon Oct 31, 2016 5:12 am    Post subject: Reply with quote

Interesting. Are there more things like createHotkey and OnHotkey?
_________________
Back to top
View user's profile Send private message MSN Messenger
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Mon Oct 31, 2016 2:38 pm    Post subject: Reply with quote

Not sure what you mean with this. Issues with critical sections ?

As for this case, I think it's easier to just create the hotkeys beforehand, and in the hotkey handler check if it should act or not

_________________
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
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Mon Oct 31, 2016 2:55 pm    Post subject: Reply with quote

Yes, issues with critical sections.
_________________
Back to top
View user's profile Send private message 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