help for a LE script

Ask gaming related questions (AHK v1.1 and older)
xdsgrrr
Posts: 1
Joined: 21 Feb 2024, 04:15

help for a LE script

21 Feb 2024, 04:23

Hi guys - struggling a bit, what do i want to do:

while pressing W i want to the sript to hold down 1, wait for 1000ms and press 4 => rinse & repeat till i release W

heres my approach:

Code: Select all

~w::
while KeyIsDown := GetKeyState("w", "p")
{
Send {1 Down}
Sleep, 10
}
Sleep, 1000
SendInput,4
Send {1 Up}
return
Ty in advance for your help - very much appreciated :)

[Mod edit: Added [code][/code] tags. Please use them yourself when posting code!]
[Mod edit: Moved topic from 'Ask for Help (v2) > Gaming' since this is AHK v1 code.]
User avatar
mikeyww
Posts: 26991
Joined: 09 Sep 2014, 18:38

Re: help for a LE script

23 Feb 2024, 07:33

Welcome to this AutoHotkey forum!

Ideas are below.

Code: Select all

#Requires AutoHotkey v1.1.33

$w::
Send w
Sleep 100 ; Optional
While GetKeyState("w", "P") {
 Send {1 down}
 Loop 2
  Sleep 500 * GetKeyState("w", "P")
 Send {1 up}
 If GetKeyState("w", "P")
  Send 4
}
SoundBeep 1500
Return
Repeating W:

Code: Select all

#Requires AutoHotkey v1.1.33

~w::
If !on {
 KeyWait w, T.1
 If ErrorLevel {
  SetTimer go, 25
  on := True
 }
}
Return

~w Up::
SetTimer go, Off
on := False
SoundBeep 1500
Return

go() {
 Send {1 down}
 Loop 2
  Sleep 500 * GetKeyState("w", "P")
 Send {1 up}
 If GetKeyState("w", "P")
  Send 4
}

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: Banaanae and 39 guests