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 


Help me add hotkey to trainer for speedhack

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

Joined: 11 Jun 2023
Posts: 3

PostPosted: Sun Jun 11, 2023 5:21 am    Post subject: Help me add hotkey to trainer for speedhack Reply with quote

i am working on a generic trainer. i already have a cheat table with scripts forspaghetti monstermode, etc. setup with hotkeys. i only have to add speedhack to it.

tutorials i saw on youtube and other platforms guide how to do it using a clickable button on trainer. i am looking to use a hotkey to toggle speedhack.

until now, on this forum i have got an idea that it is possible by creating function in lua script and then assigning a function to hotkey.

what i dont know is where do i put that code? i only know that on trainer design window, we click button and double click it to open lua script for it.

but i want a hotkey not a button. i hope i am clear and not confusing.

also, i wonder if someone can help me find a list of hotkey codes for keyboard, like vk_a, vk_b. i want to assign speed hack to middle mouse button.

the script would be something like this i wonder:

Code:

[ENABLE]
function speedhacked(sender)
speedhack_setSpeed(0.35)

return true
end

hkey=createHotkey("speedhacked",VK_middlemousebutton)
generichotkey_onHotkey(hkey,speedhacked)

[DISABLE]

speedhack_setSpeed(1)


sorry if my code and logic is horribly wrong. i just started few hours ago. please help me Crying or Very sad

TL;DR

generic trainer > hotkey bind speedhack in lua > dont know where to create script and add to trainer > also dont know keycodes for hotkeys.
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1516

PostPosted: Sun Jun 11, 2023 3:06 pm    Post subject: Reply with quote

Code:
[ENABLE]

{$lua}

state1 = 0
if speedKey then speedKey.Destroy() speedKey=nil end
speedKey = createHotkey((function()
                     sleep(200)
                     if state1==0 then
                        speedhack_setSpeed(0.35)
                        state1=1
                     else
                        speedhack_setSpeed(1)
                        state1=0
                     end
                  end), VK_F8)

{$asm}
[DISABLE]

{$lua}
if speedKey then speedKey.Destroy() speedKey=nil end
speedhack_setSpeed(1)


Virtual-Key Codes[/url]

_________________
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
gamegamer01
How do I cheat?
Reputation: 0

Joined: 11 Jun 2023
Posts: 3

PostPosted: Mon Jun 26, 2023 1:00 pm    Post subject: Thanks It Worked Smooth! Reply with quote

cant thank you enough, the code is simple understandable and thanks for keycodes list! i got confidence now Very Happy
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