I'm interested in a repeating macro, that will probably need to run by a script
Activates upon pressing "F2"
Does the following action
Holds "W"
presses "Ctrl"
presses "E"
and repeats these button presses once per second
Pressing F2 again would disable it
Repeating macro
-
- Posts: 2
- Joined: 21 Dec 2018, 02:04
Re: Repeating macro
You can set this up with a script. However the holding a key and then repeating a press would likely be two separate chunks. The first section would look like this in lua:
I use this exact script for GTA (I set a G-key to hold e for my horn) and a few other games. The next section you would need help with, I myself am stuck on repeating/looping scripts.
Closest I could think of for you (as a full script) would be:
When F2 is pressed this would then HOLD and lock "W" and then press left ctrl and almost simultaneously press "E" then wait 100 micro seconds (0.1 seconds) then release left ctrl and "E" then wait another 100ms before starting the loop again, and finally once F2 is pressed again it would release "W". I assume you want to walk forward continuously and frequently crouch and pick up an item in a game? HOWEVER do not use this without someone smarter than me fixing it. Currently it will keep running the loop section (lctrl and "E" spam) until you shut down your PC. I myself am still struggling to turn off the loops I make :/
Code: Select all
if event == "f2" then
state = not state
if state then
PressKey("w")
else
ReleaseKey("w")
end
end
Closest I could think of for you (as a full script) would be:
Code: Select all
if event == "f2" then
state = not state
if state then
PressKey("w")
while state do
PressKey("lctrl"); PressKey("e"); Sleep(100); ReleaseKey("lctrl"); ReleaseKey("e"); Sleep(100);
else
ReleaseKey("w")
end
end