View previous topic :: View next topic |
Author |
Message |
LastExceed Expert Cheater Reputation: 1
Joined: 05 Nov 2014 Posts: 130
|
Posted: Thu Aug 27, 2015 10:49 am Post subject: how do I set a hotkey that executes my lua code? |
|
|
I actually feel embarrased asking something basic like this, but all I want to do is create a trainer that simply executes my code as soon as I press a specific hotkey. The trainer needn't look any good, default layout from
file -> Generate generic trainer lua script form table is enough.
I know, I know, there are millions of tutorials already and it's absolutely unnecessary to create a new thread for this, but whenever I try to find an answer to even the most dumpest questions, I only find tutorials for way too advanced stuff instead of the simple answer I was looking for...
|
|
Back to top |
|
|
Smellyhobo101 Newbie cheater Reputation: 0
Joined: 21 Sep 2014 Posts: 23
|
Posted: Sun Aug 30, 2015 4:14 pm Post subject: |
|
|
Set up a timer to call a function. Then use an if statement with the isKeyPressed(key) function to check if the key has been pressed. "key" is a virtual-key code. You can google a full list of them.
Code: |
function main()
if isKeyPressed(VK_A) then
--Put your code here
end
end
t = createTimer(nil, false) -- create a Timer object and assign it to variable t
timer_onTimer(t, main) -- When the timer ticks, call the function main
timer_setInterval(t, 50) -- Sets the tickrate of the timer in milliseconds
timer_setEnabled(t, true) -- Turns the timer on
|
|
|
Back to top |
|
|
LastExceed Expert Cheater Reputation: 1
Joined: 05 Nov 2014 Posts: 130
|
Posted: Mon Aug 31, 2015 11:16 am Post subject: |
|
|
Thanks a lot.
|
|
Back to top |
|
|
|