spamming 12345 on mouse click, delayed Topic is solved

Ask gaming related questions (AHK v1.1 and older)
nebber
Posts: 3
Joined: 02 May 2024, 11:05

spamming 12345 on mouse click, delayed

02 May 2024, 11:22

Hi all,

I'm very new to this and given it my best shot but I'm a bit stuck. What i'd like is for my left mouse button to single-click normally, but if I hold it down for it to spam 12345 and stop spamming when i let go of the button.

I found this which works nicely for the 12345 spam, when it's mapped to a button.

Code: Select all

*Esc::ExitApp
q::
Loop
	Loop, 5
		SendInput,% A_Index
I was trying this left-click autofire script:

Code: Select all

f9::Suspend
LButton::
Loop
{
SetMouseDelay 20
Click
If(GetKeyState("LButton","P")=0)
Break
}
I mashed them together and made this:

Code: Select all

f9::Suspend
LButton::
Loop
{
SetMouseDelay 20
	Loop, 5
		SendInput,% A_Index
If(GetKeyState("LButton","P")=0)
Break
}
I tried upping the number on the setmousdelay, but this didn't change anything as far as I can tell. As is, it starts the 12345 spam as soon as i click, so I can't single-click on other things in the game.

Can anyone please let me know how I can fix this to work the way I want?

Thank you!
User avatar
mikeyww
Posts: 27162
Joined: 09 Sep 2014, 18:38

Re: spamming 12345 on mouse click, delayed  Topic is solved

02 May 2024, 19:46

Welcome to this AutoHotkey forum!

Code: Select all

#Requires AutoHotkey v1.1.33.11

~LButton::
SetKeyDelay 25, 25
KeyWait LButton, T.3
If ErrorLevel {  ; Held
 Click U
 While GetKeyState("LButton", "P")
  Loop 5
   SendEvent % A_Index
  Until !GetKeyState("LButton", "P")
}
Return
If you are new to AHK, I recommend using its current version, which is v2, instead of this older deprecated version that is no longer developed.
nebber
Posts: 3
Joined: 02 May 2024, 11:05

Re: spamming 12345 on mouse click, delayed

03 May 2024, 17:28

That works perfectly! Thanks for the help and welcoming me. I'll give v2.0 a go.
User avatar
mikeyww
Posts: 27162
Joined: 09 Sep 2014, 18:38

Re: spamming 12345 on mouse click, delayed

03 May 2024, 17:34

A v2 version is below.

Code: Select all

#Requires AutoHotkey v2.0

~LButton:: {
 SetKeyDelay 25, 25
 If !KeyWait('LButton', 'T.3') {  ; Held
  Click 'U'
  While GetKeyState('LButton', 'P')
   Loop 5
    SendEvent A_Index
   Until !GetKeyState('LButton', 'P')
 }
}
nebber
Posts: 3
Joined: 02 May 2024, 11:05

Re: spamming 12345 on mouse click, delayed

04 May 2024, 03:15

That works perfectly! Thanks for the help and welcoming me. I'll give v2.0 a go.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 22 guests