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 


Hooking game key/s, how do you do it?

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

Joined: 26 Sep 2016
Posts: 70

PostPosted: Mon Jan 22, 2018 5:19 pm    Post subject: Hooking game key/s, how do you do it? Reply with quote

I tried isKeyPressed( VK_TAB ) for limiting a rather time consuming task, worked as far as limiting goes but only returns true when I press it inside of CE, I want it to work inside the game instead.
_________________
Those who do not trust in christ to save them from their sins will only experience hell when their soul is released from it's earthly vessel.
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Mon Jan 22, 2018 5:54 pm    Post subject: Reply with quote

Form the "celua.tx" file in the Cheat Engine folder, but I only use hotkeys for scanning, so I have never set one up this way.

Code:
GenericHotkey Class : (Inheritance:  Object)
createHotkey(function, keys, ...) : returns an initialized GenericHotkey class object. Maximum of 5 keys
createHotkey(function, {keys, ...}) : ^

properties
  DelayBetweenActivate: integer - Interval in milliseconds that determines the minimum time between hotkey activations. If 0, the global delay is used
  onHotkey: The function to call when the hotkey is pressed

methods
  getKeys()
  setKeys(key, ....)
  setOnHotkey(table)
  getOnHotkey

_________________
Back to top
View user's profile Send private message Visit poster's website
zxuiji
Advanced Cheater
Reputation: 1

Joined: 26 Sep 2016
Posts: 70

PostPosted: Mon Jan 22, 2018 6:07 pm    Post subject: Reply with quote

Thanks :) I'll try it out 2mw, bout time I went to bed XD

Edit: Exactly what I'm looking for :) For everyone's reference here is what I've got:
Code:

local descMaxOutInv = 'Lua: MaxOutInv'
local hotMaxOutInv = nil
local ceMaxOutInv = nil
function EnableMaxOutInv(mr,b4,cur)
  hotMaxOutInv = createHotkey( MaxOutInv, VK_CONTROL, VK_C, VK_SPACE )
  return true
end
function DisableMaxOutInv(mr,b4,cur)
  hotMaxOutInv.destroy()
  hotMaxOutInv = nil
end
function KillMaxOutInv(mr)
  ceMaxOutInv = nil
end
ceMaxOutInv = ceList.createMemoryMethod(
  EnableMaxOutInv, DisableMaxOutInv, KillMaxOutInv )
ceMaxOutInv.Description = descMaxOutInv

_________________
Those who do not trust in christ to save them from their sins will only experience hell when their soul is released from it's earthly vessel.
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