Script sometimes wont stop spamming

Ask gaming related questions (AHK v1.1 and older)
WackJoe
Posts: 10
Joined: 05 Jul 2022, 20:29

Script sometimes wont stop spamming

Post by WackJoe » 07 Aug 2022, 08:43

So i have this simple hold-to-spam script that i use quite frequently. But ever so often the script will keep spamming even after i release the button.

Anyone has any idea why this is happening?

Code: Select all

$<::
	While ( GetKeyState( "<","P" ) ) {
		Send, e
		Sleep, 5
		Send, r
		Sleep, 5
		Send, q
		Sleep, 5
		Send, {Rbutton}
		Sleep, 5
	}
return

BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Script sometimes wont stop spamming

Post by BoBo » 07 Aug 2022, 09:05

Buffering? :think:

WackJoe
Posts: 10
Joined: 05 Jul 2022, 20:29

Re: Script sometimes wont stop spamming

Post by WackJoe » 07 Aug 2022, 09:13

BoBo wrote:
07 Aug 2022, 09:05
Buffering? :think:
Not sure what you mean by buffering? :D

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

Re: Script sometimes wont stop spamming

Post by mikeyww » 07 Aug 2022, 09:17

In some situations, if the system is not ready to receive keyboard input, the input (e.g., key-press data) is stored in a holding area (buffer), from which the data are then processed when the system becomes ready. This can lead to unexpected or unwanted results.

One idea is below (US keyboard). It may need some adjustments.

Code: Select all

+,::
SetKeyDelay, 15
on := True
ToolTip, %on%
While GetKeyState(",", "P")
 Send {Shift up}erq{RButton}
on := False
ToolTip, %on%
#If on
,::Return
#If

WackJoe
Posts: 10
Joined: 05 Jul 2022, 20:29

Re: Script sometimes wont stop spamming

Post by WackJoe » 07 Aug 2022, 10:33

mikeyww wrote:
07 Aug 2022, 09:17
In some situations, if the system is not ready to receive keyboard input, the input (e.g., key-press data) is stored in a holding area (buffer), from which the data are then processed when the system becomes ready. This can lead to unexpected or unwanted results.

One idea is below (US keyboard). It may need some adjustments.

Code: Select all

+,::
SetKeyDelay, 15
on := True
ToolTip, %on%
While GetKeyState(",", "P")
 Send {Shift up}erq{RButton}
on := False
ToolTip, %on%
#If on
,::Return
#If
I will give this a shot and see if this help. For now thanks alot <3

Post Reply

Return to “Gaming Help (v1)”