Page 1 of 1
Help with making code for keyboard Macro
Posted: 24 Apr 2024, 16:08
by omeganexus
I need help creating a macro that works in the Armored Core 6 game.
Basically, I need that when pressing the Shift+Q Keys, the Macro leaves the Q and E Keys pressed infinitely, until the Q Key is pressed, thus releasing both keys.
Re: Help with making code for keyboard Macro
Posted: 24 Apr 2024, 21:18
by Noitalommi_2
Hi.
@omeganexus
Can't test it, but this might work.
Code: Select all
#Requires AutoHotkey 2.0
#SingleInstance
+q::SendEvent "{q down}{e down}" ; shift+q
q::{
if GetKeyState("q")
SendEvent "{q up}"
if GetKeyState("e")
SendEvent "{e up}"
}
Re: Help with making code for keyboard Macro
Posted: 26 Apr 2024, 19:07
by omeganexus
Noitalommi_2 wrote: ↑24 Apr 2024, 21:18
Hi. @omeganexus
Can't test it, but this might work.
Code: Select all
#Requires AutoHotkey 2.0
#SingleInstance
+q::SendEvent "{q down}{e down}" ; shift+q
q::{
if GetKeyState("q")
SendEvent "{q up}"
if GetKeyState("e")
SendEvent "{e up}"
}
The code you posted didn't work. I needed the Q and E Keys to be pressed infinitely, in a loop, until the Q Key was pressed. However, I realized that I couldn't use the Q and E Keys as a condition for ending the loop, after all they were always in the "Down" state.
That's why I used a new shortcut, the Shift+R hotkey to activate the Macro, and the R Key as a condition for the end of the loop. However, I realized that the GetkeyState function takes a few milliseconds to update, and that's why I needed to add a sleep with 150 milliseconds to give the R key's state time to update.
In the game it worked really well. Still, thank you very much for your help.
Code: Select all
+r::{
sleep 150
loop{
SendEvent "{q down}{e down}" ; shift+r
} until KeyWait("r" , "D")
SendEvent "{q up}{e up}"
}