I'm quite new in this awesome method how customize your computer keyboard actions by AHK
So I decided that I can use it for Minecraft autorun, instead of using some game modifications.
I was trying make some script for it, first tage was this which i also found here by some wonderful helper:
Code: Select all
#SingleInstance, Ignore
#If WinActive("ahk_class GLFW30")
XButton2::
KeyDown := !KeyDown
If KeyDown
SendInput {w down}
Else
SendInput {w up}
Return
#If
LControl & LShift::ExitApp
But I can't end up with working solution.
My try is this:
Code: Select all
#SingleInstance, Ignore
#If WinActive("ahk_class GLFW30")
XButton2::
Pressed := 1
!XButton2::
Pressed := 0
If (Pressed)
SendInput {w down}
else
SendInput {w up}
return
/* C++ reference for what i want to do
bool pressed;
if (KeyPressed == XButton2) {
pressed = true;
}
if (KeyPressed != XButton2) {
pressed = false;
}
if (pressed) {
Key('w').MakeItHold();
} else {
Key('w').MakeItUnhold();
}
*/
#If