problem with automatic clicking while holding the left / right button Topic is solved

Ask gaming related questions (AHK v1.1 and older)
KongKing
Posts: 76
Joined: 22 May 2022, 09:41

problem with automatic clicking while holding the left / right button

Post by KongKing » 23 Aug 2022, 14:51

Hello! I have a problem with the autoclicker, when I turn on the bind everything works, but if I hold down the left or right mouse button all the time and turn it off and want to turn it on again, I keep the left / right button all the time, don't turn it on! I have to let go and hold again! does anyone know how to fix it?

Code: Select all

Gui, Show, w200 h200, //
Gui, Add, Edit, gsave vbindl , b
Gui, Add, Edit, gsave vbindr , r
return
save:
Gui, Submit, NoHide
IF StrLen(GetKeyName(bindl))
	Hotkey, %bindl% Up, bindl
IF StrLen(GetKeyName(bindr))
	Hotkey, %bindr% Up, bindr
return
bindl:
ToggleL:=!ToggleL
Return
~LButton::
While, ToggleL And GetKeyState("LButton", "P")
	Click
return
bindr:
ToggleR:=!ToggleR
Return
~RButton::
While, ToggleR And GetKeyState("RButton", "P")
	Click Right
return

Rohwedder
Posts: 7769
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: problem with automatic clicking while holding the left / right button

Post by Rohwedder » 24 Aug 2022, 01:40

Hallo,
try:

Code: Select all

ToggleL := ToggleR := 0
Gui, Show, w200 h200, //
Gui, Add, Edit, gsave vbindl, b
Gui, Add, Edit, gsave vbindr, r
return
save:
Gui, Submit, NoHide
IF StrLen(GetKeyName(bindl))
	Hotkey, %bindl% Up, bindl
IF StrLen(GetKeyName(bindr))
	Hotkey, %bindr% Up, bindr
return
bindl:
ToggleL:=!ToggleL
Return
~LButton::
While,  GetKeyState("LButton", "P")
	Click %ToggleL%
return
bindr:
ToggleR:=!ToggleR
Return
~RButton::
While, GetKeyState("RButton", "P")
	Click Right %ToggleR%
return

KongKing
Posts: 76
Joined: 22 May 2022, 09:41

Re: problem with automatic clicking while holding the left / right button

Post by KongKing » 24 Aug 2022, 07:42

Thank you, it works! But how do I add sleep to that with an edit field, because it adds and doesn't work

Rohwedder
Posts: 7769
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: problem with automatic clicking while holding the left / right button  Topic is solved

Post by Rohwedder » 25 Aug 2022, 02:07

Then,
try:

Code: Select all

ToggleL := ToggleR := 0
Gui, Show, w200 h200, //
Gui, Add, Edit, x10 gsave vbindl, b
Gui, Add, Edit, x+10 gsave vSleepL Number, 100
Gui, Add, Edit, x10 gsave vbindr, r
Gui, Add, Edit, x+10 gsave vSleepR Number, 100
return
save:
Gui, Submit, NoHide
IF StrLen(GetKeyName(bindl))
	Hotkey, %bindl% Up, bindl
IF StrLen(GetKeyName(bindr))
	Hotkey, %bindr% Up, bindr
return
bindl:
ToggleL:=!ToggleL
Return
~LButton::SetTimer, TL,% Max(10, SleepL)
~LButton Up::SetTimer, TL, Off
TL:
Click %ToggleL%
return
bindr:
ToggleR:=!ToggleR
Return
~RButton::SetTimer, TR,% Max(10, SleepR)
~RButton Up::SetTimer, TR, Off
TR:
Click Right %ToggleR%
return

KongKing
Posts: 76
Joined: 22 May 2022, 09:41

Re: problem with automatic clicking while holding the left / right button

Post by KongKing » 25 Aug 2022, 06:40

Wooow! Thanks you!

KongKing
Posts: 76
Joined: 22 May 2022, 09:41

Re: problem with automatic clicking while holding the left / right button

Post by KongKing » 25 Aug 2022, 13:49

Can someone tell me more how to do the autoclicker on the right could be turned on if you click on the left?

Rohwedder
Posts: 7769
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: problem with automatic clicking while holding the left / right button

Post by Rohwedder » 26 Aug 2022, 00:46

Now, both clickers depend on whether the LButton or RButton are pressed.
(A logical or not a colloquial or = logical xor, at least in german there is this difference):

Code: Select all

#InstallMouseHook
ToggleL := ToggleR := 0
Gui, Show, w200 h200, //
Gui, Add, Edit, x10 gsave vbindl, b
Gui, Add, Edit, x+10 gsave vSleepL Number, 100
Gui, Add, Edit, x10 gsave vbindr, r
Gui, Add, Edit, x+10 gsave vSleepR Number, 100
return
save:
Gui, Submit, NoHide
IF StrLen(GetKeyName(bindl))
	Hotkey, %bindl% Up, bindl
IF StrLen(GetKeyName(bindr))
	Hotkey, %bindr% Up, bindr
return
~LButton::
~RButton::
SetTimer, TL,% Max(10, SleepL)
SetTimer, TR,% Max(10, SleepR)
Return
~LButton Up::
~RButton Up::
IF GetKeyState("LButton","P") Or GetKeyState("RButton","P")
	Return
SetTimer, TL, Off
SetTimer, TR, Off
Return
bindl:
ToggleL:=!ToggleL
Return
TL:
Click %ToggleL%
return
bindr:
ToggleR:=!ToggleR
Return
TR:
Click Right %ToggleR%
return


Post Reply

Return to “Gaming Help (v1)”