View previous topic :: View next topic |
Author |
Message |
Aprendiz How do I cheat? Reputation: 0
Joined: 25 Nov 2016 Posts: 7
|
Posted: Sat Dec 23, 2017 10:01 am Post subject: macro repeat help |
|
|
can anyone teach me how to make a macro that keeps repeating the (space bar)
|
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Sat Dec 23, 2017 11:44 am Post subject: |
|
|
off the top of my head I think something like Code: | while true do doKeyPress(VK_SPACE) end | would work...probably impractical though lol
Something slightly more practical would be Code: | {$lua}
[ENABLE]
-- for key codes see defines.lua and/or https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx
local enableKey = VK_F5
local disableKey = VK_F6
local macroTimer
hk = createHotkey(function(sender)
if macroTimer then return end -- don't create a new timer if one already exists
macroTimer = createTimer()
macroTimer.Interval = 100
macroTimer.OnTimer = function()
doKeyPress(VK_SPACE)
end
end, enableKey)
hk2 = createHotkey(function(sender)
if macroTimer then
macroTimer.destroy()
macroTimer = nil
end
end, disableKey)
[DISABLE]
hk2.onHotkey() -- call disable timer code
-- destroy hotkeys so you can't enable the timer again until script is re-enabled
hk.destroy()
hk2.destroy()
| which creates 2 hotkeys, the first creates a timer which just repeatedly calls doPressKey with the code for a space, the second destroys that timer which makes it stop. When the script is disabled it stops the timer and disables the hotkeys by destroying them.
Make sure that if you have other scripts they don't also use hk and hk2, or change the names to something unique (or put them in a single global table with a unique name etc.) so that they don't get overwritten.
Last edited by FreeER on Sat Dec 23, 2017 6:26 pm; edited 1 time in total |
|
Back to top |
|
|
Aprendiz How do I cheat? Reputation: 0
Joined: 25 Nov 2016 Posts: 7
|
Posted: Sat Dec 23, 2017 1:45 pm Post subject: |
|
|
FreeER wrote: | off the top of my head I think something like Code: | while true do doKeyPress(VK_SPACE) end | would work...probably impractical though lol
Something slightly more practical would be Code: | {$lua}
[ENABLE]
local enableKey = VK_F5
local disableKey = VK_F6
local macroTimer
hk = createHotkey(function(sender)
if macroTimer then return end -- don't create a new timer if one already exists
macroTimer = createTimer()
macroTimer.Interval = 100
macroTimer.OnTimer = function()
doKeyPress(VK_SPACE)
end
end, enableKey)
hk2 = createHotkey(function(sender)
if macroTimer then
macroTimer.destroy()
macroTimer = nil
end
end, disableKey)
[DISABLE]
hk2.onHotkey() -- call disable timer code
-- destroy hotkeys so you can't enable the timer again until script is re-enabled
hk.destroy()
hk2.destroy()
| which creates 2 hotkeys, the first creates a timer which just repeatedly calls doPressKey with the code for a space, the second destroys that timer which makes it stop. When the script is disabled it stops the timer and disables the hotkeys by destroying them.
Make sure that if you have other scripts they don't also use hk and hk2, or change the names to something unique (or put them in a single global table with a unique name etc.) so that they don't get overwritten. |
Can you teach me how to do it from the start?
and I do not know how to do it
|
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Sat Dec 23, 2017 2:09 pm Post subject: |
|
|
Open the memory viewer, go to tools->auto assemble, copy and paste the code, go to file->assign to current cheat table, close the editor and enable the script.
Beyond that google a lua course online like https://www.youtube.com/watch?v=iMacxZQMPXs and learn the basics of the language, then open the celua.txt file in cheat engine's install directory and start looking at what CE makes available to you and playing around with things to see how they work. CE also has a "Lua Engine" window (memory viewer, tools->Lua Engine) that's more like the interpreted environments you'll likely see in the videos where you type one statement and execute it.
If you have any specific questions about how something works or why it works then feel free to ask those...
|
|
Back to top |
|
|
Aprendiz How do I cheat? Reputation: 0
Joined: 25 Nov 2016 Posts: 7
|
Posted: Sat Dec 23, 2017 6:18 pm Post subject: |
|
|
it works but when I connect it in the game it gives a click so the pair works
|
|
Back to top |
|
|
|