Issue with inconsistent script speed

Ask gaming related questions (AHK v1.1 and older)
Dystopia
Posts: 6
Joined: 08 Apr 2020, 10:02

Issue with inconsistent script speed

26 Apr 2020, 21:46

So I'm trying to make a script that rapidly fires off a number of commands while a key is pressed. So far, it works seemingly fine(?), but I noticed the script randomly slows down as if lagging sometimes. Initially I thought this was due to the game lagging, but my friend who used his keyboard driver software to simulate the EXACT same keypresses and delays is able to pull it off more times than me (ie in my testing, I've gotten the game to fire off the specific combo 260 times in a minute, while he has managed 360 times. For reference, the supposed fastest you can fire this combo in the game known so fast is ~444 times, which should mean that the game is able to pick up inputs at least that fast).

This is my current script
Spoiler
I've tried to speed up the script with stuff from here, but it hasn't seemed to change anything. I've tried various sleep values and command orders, but I haven't been able to break the 260/min mark. Any help is appreciated.
Rohwedder
Posts: 7774
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Issue with inconsistent script speed

28 Apr 2020, 05:41

Hallo,
perhaps:

Code: Select all

v::
while GetKeyState(A_ThisHotkey)
{
	SendInput,	o[
	Sleep, 8
	SendInput,	{space}
	Sleep, 27
}
return
Dystopia
Posts: 6
Joined: 08 Apr 2020, 10:02

Re: Issue with inconsistent script speed

28 Apr 2020, 21:15

Rohwedder wrote:
28 Apr 2020, 05:41
Hallo,
perhaps:

Code: Select all

v::
while GetKeyState(A_ThisHotkey)
{
	SendInput,	o[
	Sleep, 8
	SendInput,	{space}
	Sleep, 27
}
return
This seems to have made it a lot more consistent, thanks!

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: Google [Bot], mexican scientist and 69 guests