Randomly long press w a s or d not working

Ask gaming related questions (AHK v1.1 and older)
Underscones
Posts: 1
Joined: 15 Aug 2022, 12:24

Randomly long press w a s or d not working

Post by Underscones » 15 Aug 2022, 12:27

I have a script here thats used to afk grind XP but the random WASD is not working.

Code: Select all

sleep, 1000
	start_time := A_TickCount
	time_to_run := 1800000
	end_time := start_time + time_to_run

arr := [w, a, s, d]

while (A_tickCount < end_time) {
    Random, oVar, 1, 4
    send, {arr[oVar] down}
    sleep, 500
    send, {arr[oVar] up}
}
sleep, 10000
send, {Esc}
sleep, 500
send, {l}
sleep, 500
send, {Enter}
Any help would be greatly apprieciated.

User avatar
mikeyww
Posts: 26848
Joined: 09 Sep 2014, 18:38

Re: Randomly long press w a s or d not working

Post by mikeyww » 15 Aug 2022, 19:44

Welcome to this AutoHotkey forum!

Code: Select all

arr := ["w", "a", "s", "d"]
Random, oVar, 1, arr.Count()
Send % "{" arr[oVar] " down}"
Sleep, 500
Send % "{" arr[oVar] " up}"
SoundBeep, 1500
Explained: Expressions

Code: Select all

letterList = wasd
Random, oVar, 1, StrLen(letterList)
letter := SubStr(letterList, oVar, 1)
Send {%letter% down}
Sleep, 500
Send {%letter% up}
SoundBeep, 1500

Post Reply

Return to “Gaming Help (v1)”