Hello! I need help, I have two scripts which hold down A and then another that holds down D when a button is toggled. I wanna combined these two so that the script holds down the A key for 38 seconds then it switches and holds down the D key and then switches again until I toggle the script. This is the script for a single button hold down (Press left arrow and it holds down A) can anyone help me with how I should combine these two scripts with sleep or timer in between to make them switch after 38 seconds.
Code: Select all
#Persistent
#MaxThreadsPerHotkey 2
toggle := False
Left UP::
toggle := !toggle
Loop {
If (!toggle) {
send,{a UP}
break
}
send,{a DOWN}
sleep 10
}
Return
This is what I came up with so far with some help but the issue with the code underneath is that it doesn't actually hold down the keys when script is ran.
Code: Select all
A := true
Left Up::SetTimer, AD38, % (toggle := !toggle) ? 38000 : "Off"
AD38:
if (toggle)
{
if (A = true)
{
SendInput, {D Up}
SendInput, {A Down}
A := false
}
else
{
SendInput, {A Up}
SendInput, {D Down}
A := true
}
}
else
{
SendInput, {A Up}
SendInput, {D Up}
A := true
}
return
So in conclusion Im trying to make a script that holds down the A key for 38 seconds then switches to the D key for 38 seconds and then again back to A key and so on for infinity until the toggle key is pressed again.[/Codebox]