Reputation: 133
What it should do
z -> SetTimer, loop, -1
loop ->
IfWinActive
-> press key
!IfWinActive
-> release key
My Code:
#SingleInstance Force
z::
SetTimer, loop, -1
return
loop:
IfWinActive, Minecraft 1.8.9 | LabyMod 3.6.13
{
; Press key aslong true
}
return
But I simply not know how to simulate a key press aslong something is true
Now I have this
It loops loop
until i press z again
loop :=0
z::
if (GetKeyState("w"))
{ ; turns the loop off if w is already pressed
loop :=0
SetTimer, loop, Off
Send {w} ; send w again so you stop running why ever minecraft is like that
}
else
{
loop :=1
SetTimer, loop, 1
}
return
loop:
while (loop)
{
IfWinActive, Minecraft 1.8.9 | LabyMod 3.6.13
{
Send % "{w Down}"
}
IfWinNotActive, Minecraft 1.8.9 | LabyMod 3.6.13
{
Send % "{w Up}"
}
}
return
But the problem is it constantly presses w up
or w down
if i wanny tab out the game it becomes buggy because i cant do a shortcut because it keeps interrupted by w down
. it should only press w down
until i tab out then it should press w up
until i go in minecraft again
Upvotes: 0
Views: 884
Reputation: 128
(fixed) i see your right you can't alt tab out of anything but you can make it stop when you press alt or tab like this. (also this is really useful i'm going to be using this in the future)
loop := 0
z::
if (GetKeyState("w"))
{ ; turns the loop off if w is already pressed
loop := 0
SetTimer, loop, Off
Send {w} ; send w again so you stop running why ever minecraft is like that
}
else
{
loop := 1
SetTimer, loop, 1
}
return
loop:
while (loop)
{
IfWinActive, Minecraft 1.8.9 | LabyMod 3.6.13
{
if (GetKeyState("w")) Not {
Send % "{w Down}"
}
}
IfWinActive, Minecraft 1.8.9 | LabyMod 3.6.13
{
if (GetKeyState("w")) {
Send % "{w Up}"
}
}
}
return
!tab::
sleep, 100
send {d up}
send {alt down}
send {tab}
send {alt up}
return
you can change pressing down to this in to make it auto sprint!
{
if (GetKeyState("w")) Not {
sleep, 100
Send % "{w Down}"
sleep, 50
Send % "{w Up}"
sleep, 50
Send % "{w Down}"
}
}
Upvotes: 0
Reputation: 128
(tested) setting timer to -1 doesn't work for some reason replace (key) with the actual key to hold down
z::
SetTimer, loop, 1
return
loop:
IfWinActive, Minecraft 1.8.9 | LabyMod 3.6.13
{
send {(key) down}
} else {
send {(key) up}
}
return
Upvotes: 1