Help to constantly click right click when holding it

Ask gaming related questions (AHK v1.1 and older)
_IAmANoob_
Posts: 2
Joined: 29 Nov 2015, 05:35

Help to constantly click right click when holding it

29 Nov 2015, 05:38

hey guys im new and im a big noob, i wanna play Minecraft but im tired to constantly click right click to attack,
so i want like when i hold right click, it will attack with around 10 - 15 cps.
when i stop holding right click, it stops
grant
Posts: 323
Joined: 14 Oct 2015, 17:27

Re: Help to constantly click right click when holding it

29 Nov 2015, 08:23

Random number between 8 and 12 clicks per second, while holding down the left mouse button and calculated at each delay between clicks. Only because I had the code lying around.

Code: Select all

cpsmin := 8
cpsmax := 12

~$LButton::
    While GetKeyState("LButton", "P")
	{
        Click
        delay := delay(8,12)
	Sleep %delay%
	}
return


delay(cpsmin, cpsmax)
{
Random, number, cpsmin, cpsmax
delay := 1000/number
;msgbox, %delay%
return, %delay%
}
_IAmANoob_
Posts: 2
Joined: 29 Nov 2015, 05:35

Re: Help to constantly click right click when holding it

29 Nov 2015, 08:45

thanks! this worked well for me
Evan2533
Posts: 3
Joined: 02 Aug 2021, 12:53

Re: Help to constantly click right click when holding it

02 Aug 2021, 12:58

Is it possible someone can recreate this with right clicking instead?
Ianizer
Posts: 79
Joined: 07 Mar 2021, 00:06

Re: Help to constantly click right click when holding it

02 Aug 2021, 13:06

@Evan2533
Just some replacing:

Code: Select all

cpsmin := 8
cpsmax := 12

~$RButton::
    While GetKeyState("RButton", "P")
	{
        Click Right
        delay := delay(8,12)
	Sleep %delay%
	}
return


delay(cpsmin, cpsmax)
{
Random, number, cpsmin, cpsmax
delay := 1000/number
;msgbox, %delay%
return, %delay%
}
sarengan719
Posts: 3
Joined: 09 Aug 2021, 00:02

Re: Help to constantly click right click when holding it

09 Aug 2021, 02:14

@Ianizer
-Can you help me make a macro
Macro for Right Click : If hold Right Click =>Press F2 ( or 2 ) wait300 hold F7 2000 wait 300 F2 wait300 F4 ) loop and stop when i stop hold.
- Page Up to pause script
-page down to use script again
Ianizer
Posts: 79
Joined: 07 Mar 2021, 00:06

Re: Help to constantly click right click when holding it

09 Aug 2021, 09:51

@sarengan719
I think this is what you're asking:

Code: Select all

SendMode, Input
~*$RButton::
	while GetKeyState("RButton", "P")
	{
		Send, {F2}
		Sleep, 300
		Send, {F7 Down}
		Sleep, 300
		Send {F7 Up}{F2}
		Sleep, 300
		Send {F4}
		Sleep, 100
	}
return

PgUp::Pause, On
PgDn::Pause, Off
sarengan719
Posts: 3
Joined: 09 Aug 2021, 00:02

Re: Help to constantly click right click when holding it

09 Aug 2021, 20:46

@Ianizer
Ths you verymuch
HikariChama
Posts: 6
Joined: 03 Jun 2022, 01:03

Re: Help to constantly click right click when holding it

03 Jun 2022, 01:06

@Ianizer
The above cps script(hold and it repeats one) but is there a way to set hotkey for it? like M key on keyboard and such or do u need another script?
Ianizer
Posts: 79
Joined: 07 Mar 2021, 00:06

Re: Help to constantly click right click when holding it

03 Jun 2022, 16:22

@HikariChama
If neither of these is what you're asking for, please make a new forum topic (the button on the left of this link: viewforum.php?f=18) and give step-by-step instructions for what you want the script to do.
SCRIPT 1:
Only autoclicks while holding left click if M toggled its ability to do so.

Code: Select all

#MaxThreadsPerHotkey, 2
cpsmin := 8
cpsmax := 12

#If (SpamClick)
LButton::
	while (GetKeyState("LButton", "P") && SpamClick)
	{
        Click
		Sleep, delay(cpsmin, cpsmax)
	}
return
#If

m::
	SpamClick := !SpamClick
	gosub, LButton ;so if LButton is currently held, it will start clicking
return

delay(cpsmin, cpsmax)
{
	Random, number, cpsmin, cpsmax
	return 1000/number
}
SCRIPT 2:
Starts clicking once M is pressed, stops when pressed again.

Code: Select all

#MaxThreadsPerHotkey, 2
cpsmin := 8
cpsmax := 12

m::
	KeepClicking := !KeepClicking
    while (KeepClicking)
	{
        Click
		Sleep, delay(cpsmin, cpsmax)
	}
return

delay(cpsmin, cpsmax)
{
	Random, number, cpsmin, cpsmax
	return 1000/number
}
HikariChama
Posts: 6
Joined: 03 Jun 2022, 01:03

Re: Help to constantly click right click when holding it

01 Oct 2022, 10:16

@Ianizer Thanks a lot, first one's exactly what i was looking for how do you turn it into right click as well?
HikariChama
Posts: 6
Joined: 03 Jun 2022, 01:03

Re: Help to constantly click right click when holding it

01 Oct 2022, 10:23

Ah also I forgot to mention but is it also possible to be able to type the letter m as well while the script also works itself out?
sofista
Posts: 644
Joined: 24 Feb 2020, 13:59
Location: Buenos Aires

Re: Help to constantly click right click when holding it

02 Oct 2022, 20:45

HikariChama wrote:
01 Oct 2022, 10:16
@Ianizer Thanks a lot, first one's exactly what i was looking for how do you turn it into right click as well?
Just replace LButton by RButton as was done in an earlier post in this same thread:

Code: Select all

#MaxThreadsPerHotkey, 2
cpsmin := 8
cpsmax := 12

#If (SpamClick)
RButton::
	while (GetKeyState("RButton", "P") && SpamClick) {
		Click
		Sleep, delay(cpsmin, cpsmax)
	}
return
#If

~m::
	SpamClick := !SpamClick
	ToolTip, % SpamClick    ; added to let you know the toggle status —1 is true or active—, you can safely remove if it is of no help for you.
	gosub, RButton    ; so if RButton is currently held, it will start clicking
return

delay(cpsmin, cpsmax) {
	Random, number, cpsmin, cpsmax
	return 1000/number
}
and
HikariChama wrote:
01 Oct 2022, 10:23
Ah also I forgot to mention but is it also possible to be able to type the letter m as well while the script also works itself out?
I could be wrong, but I think it is not possible, because as soon as you press m, the toggle changes its status and the hotkey becomes inactive.

Instead, you may want to suspend the script in order to use the letter m as usual, for example:

Code: Select all

|::Suspend, Toggle
HikariChama
Posts: 6
Joined: 03 Jun 2022, 01:03

Re: Help to constantly click right click when holding it

13 Oct 2022, 09:40

@sofista The first one started clicking left click when holding right, i tried to change various keys etc but i cant figure what to do in order to get it to click right, I swapped various key words and never got what i need and instead got ones where it left clicks or right clicks when holding m key.

On that note, I kind of dont know much about this so do i use the second one as seperate script or something?
sofista
Posts: 644
Joined: 24 Feb 2020, 13:59
Location: Buenos Aires

Re: Help to constantly click right click when holding it

13 Oct 2022, 19:54

HikariChama wrote:
13 Oct 2022, 09:40
@sofista The first one started clicking left click when holding right, i tried to change various keys etc but i cant figure what to do in order to get it to click right, I swapped various key words and never got what i need and instead got ones where it left clicks or right clicks when holding m key.
If I understood you correctly, replace line 8 of the script by the following:

Code: Select all

Click, Right
On that note, I kind of dont know much about this so do i use the second one as seperate script or something?
If you mean the hotkey to suspend the script, you can put it at the bottom of the script itself.
HikariChama
Posts: 6
Joined: 03 Jun 2022, 01:03

Re: Help to constantly click right click when holding it

15 Nov 2022, 22:05

Thank you so much, it worked correctly, I have no experience in these so sorry about it.
HikariChama
Posts: 6
Joined: 03 Jun 2022, 01:03

Re: Help to constantly click right click when holding it

15 Nov 2022, 22:12

On that topic, i see that no matter how much cps i change it to, it's stuck in a range of 10-17 cps in actuality, is there a way to go above and beyond like 50, 100 and so on
sinosino
Posts: 2
Joined: 16 Mar 2023, 02:55

Re: Help to constantly click right click when holding it

16 Mar 2023, 03:02

Ianizer wrote:
02 Aug 2021, 13:06
@Evan2533
Just some replacing:

Code: Select all

cpsmin := 8
cpsmax := 12

~$RButton::
    While GetKeyState("RButton", "P")
	{
        Click Right
        delay := delay(8,12)
	Sleep %delay%
	}
return


delay(cpsmin, cpsmax)
{
Random, number, cpsmin, cpsmax
delay := 1000/number
;msgbox, %delay%
return, %delay%
}
Can you please help to also add "F4" as repeated along with the right click while holding??
Ianizer
Posts: 79
Joined: 07 Mar 2021, 00:06

Re: Help to constantly click right click when holding it

18 Mar 2023, 08:57

@sinosino
I added F4 like you asked and made the code more concise for the same result.

Code: Select all

cpsmin := 8
cpsmax := 12

~$RButton::
    While GetKeyState("RButton", "P")
	{
        Click Right
        SendInput, {F4}
        Sleep delay(cpsmin, cpsmax)
	}
return


delay(cpsmin, cpsmax)
{
Random, number, cpsmin, cpsmax
return, 1000/number
}
sinosino
Posts: 2
Joined: 16 Mar 2023, 02:55

Re: Help to constantly click right click when holding it

19 Mar 2023, 05:08

@Ianizer
WOW! awesome works amazing. Thank you so much!

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 54 guests