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 


Disable hotkeys in Lua

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

Joined: 30 Jan 2018
Posts: 25

PostPosted: Fri Mar 23, 2018 10:19 am    Post subject: Disable hotkeys in Lua Reply with quote

Is it possible to disable hotkeys in lua?

I'm using this code for the hotkeys:

Code:

--Time 1
function Reset(sender)
os.execute("time 00:31:55 & date 01/01/2017 & exit")
end
createHotkey(Reset, VK_NUMPAD1)

--Time 2
function Reset2(sender)
os.execute("time 15:47:56 & date 02/01/2017 & exit")
end
createHotkey(Reset2, VK_NUMPAD2)

--Time 3
function Reset3(sender)
os.execute("time 06:48:03 & 02/01/2017 & exit")
end
createHotkey(Reset3, VK_NUMPAD3)
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Fri Mar 23, 2018 12:18 pm    Post subject: Reply with quote

createHotkey returns a hotkey object that you can .destroy()
_________________
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
Johnden
Cheater
Reputation: 0

Joined: 30 Jan 2018
Posts: 25

PostPosted: Fri Mar 23, 2018 1:32 pm    Post subject: Reply with quote

Can't get it to work
Code:

function CEButton1Click(sender)
createHotkey(Reset, VK_NUMPAD1)
createHotkey(Reset2, VK_NUMPAD2)
createHotkey(Reset3, VK_NUMPAD3)

end

function CEButton2Click(sender)
createHotkey(Reset, VK_NUMPAD1).destroy()
createHotkey(Reset2, VK_NUMPAD2).destroy()
createHotkey(Reset3, VK_NUMPAD3).destroy()
end

Tried using GenericHotkey.destroy(), didn't work either.
I think I may have something wrong with the second function.
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Fri Mar 23, 2018 2:10 pm    Post subject: Reply with quote

Johnden wrote:
Can't get it to work
Code:

function CEButton1Click(sender)
createHotkey(Reset, VK_NUMPAD1)
createHotkey(Reset2, VK_NUMPAD2)
createHotkey(Reset3, VK_NUMPAD3)

end

function CEButton2Click(sender)
createHotkey(Reset, VK_NUMPAD1).destroy()
createHotkey(Reset2, VK_NUMPAD2).destroy()
createHotkey(Reset3, VK_NUMPAD3).destroy()
end

Tried using GenericHotkey.destroy(), didn't work either.
I think I may have something wrong with the second function.


Your creating hot-keys with the first function, then creating new hot-keys and instantly destroying them with the second function.

Try some thing like this:
Code:
function CEButton1Click(sender)
   Reset_HK = createHotkey(Reset, VK_NUMPAD1)
   Reset2_HK = createHotkey(Reset2, VK_NUMPAD2)
   Reset3_HK = createHotkey(Reset3, VK_NUMPAD3)
end

function CEButton2Click(sender)
   Reset_HK.destroy()
   Reset2_HK.destroy()
   Reset3_HK.destroy()
end

_________________
Back to top
View user's profile Send private message Visit poster's website
Johnden
Cheater
Reputation: 0

Joined: 30 Jan 2018
Posts: 25

PostPosted: Fri Mar 23, 2018 2:20 pm    Post subject: Reply with quote

Why didn't I think of that?
Thank you.
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