Hold w to activate abilities on a timer using SetTimer

Ask gaming related questions (AHK v1.1 and older)
omnblack
Posts: 1
Joined: 01 Oct 2018, 09:47

Hold w to activate abilities on a timer using SetTimer

Post by omnblack » 01 Oct 2018, 10:01

This is the first script I'm trying to make. I'm trying to make it so that as I hold w two abilities are activated on a timer if they have not been pressed within a time interval. This works but initially, it waits. I want the abilities to fire first then wait if they haven't been pressed. Any help is appreciated.

Code: Select all

KeyWait w
	SetTimer, Ability1, 3400
	SetTimer, Ability2, 11000
Exit

Ability1:
	If GetKeyState("w", "P")
		{
		Send, {1 down}
		Sleep 10
		Send, {1 up}
		}
Return

Ability2:
	If GetKeyState("w", "P")
		{
		Send, {2 down}
		Sleep 10
		Send, {2 up}
		}
Return

Return to “Gaming Help (v1)”