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 


createHotkey inconsistent behaviour

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Mac99
Newbie cheater
Reputation: 0

Joined: 13 Sep 2022
Posts: 14

PostPosted: Fri Oct 14, 2022 5:30 pm    Post subject: createHotkey inconsistent behaviour Reply with quote

I've tried to define for my buttons a hotkey, which when pressed calls the button's Click function.
I've now run into the problem that some hotkeys work when I try to develop the trainer (the normal Cheat Engine environment),
but when I use the Trainer as an EXE the hotkeys don't work anymore.

Also, I don't know if Cheat Engine has some issues with the game reserving so many hotkeys because there are only a handful of keys that work when developing the trainer.

In my case, only the F1-F5 work during development and Numpad+. As an EXE only the key "Home" and "Insert" work. All the other keys don't work.

This is my code

Code:
--GhostMode
createHotkey(CETrainer_1_CEToggleBox4Click,VK_SUBTRACT)
--Change Class
createHotkey(CETrainer_CEButton3Click,VK_HOME)
--Change Team
createHotkey(CETrainer_CECheckbox1Click,VK_INSERT)
--Instant Interaction
createHotkey(CETrainer_1_CEToggleBox3Click,VK_DELETE)
--Deactivate Ability Cooldown
createHotkey(CETrainer_1_CEToggleBox3Click,VK_F3)
--Unlimited Placements
createHotkey(CETrainer_1_CEToggleBox1Click,VK_F4)
--Change Weapon1
createHotkey(CETrainer_1_CEButton1Click,VK_F2)
--UnlimitedAmmo
createHotkey(CETrainer_1_CEToggleBox6Click,VK_ADD)


Any idea why some keys work when developing and testing the Trainer and don't work in the final EXE?
Back to top
View user's profile Send private message
cooleko
Grandmaster Cheater
Reputation: 11

Joined: 04 May 2016
Posts: 717

PostPosted: Fri Oct 14, 2022 10:57 pm    Post subject: Reply with quote

You have an _1 in all the hot keys you say dont work, is it possible that the naming is off or whatever element it refers to doesnt exist once compiled to exe?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 473

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

PostPosted: Sat Oct 15, 2022 12:52 am    Post subject: Reply with quote

the createHotkey lines must be executed after the functions have been defined. So if you put this codenat the top, it'll fail
_________________
Tools give you results. Knowledge gives you control.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 39

Joined: 16 Feb 2017
Posts: 1572

PostPosted: Sat Oct 15, 2022 11:00 am    Post subject: Re: createHotkey inconsistent behaviour Reply with quote

Mac99 wrote:
Any idea why some keys work when developing and testing the Trainer and don't work in the final EXE?


İdea ..
Code:
 --GhostMode

function GhostMode()
sleep(200)
--your code
end

-- Avoid re-creating it at edit time! (KillHotkey)
if GhostM then GhostM.Destroy() GhostM=nil end

GhostM = createHotkey(GhostMode, VK_SUBTRACT)
-- Edit ToggleBox name ..
CETrainer1.CEToggleBox4.OnClick = GhostMode

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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