help for an autoclicker script please :( Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Mouaz
Posts: 15
Joined: 07 Jun 2021, 14:52

help for an autoclicker script please :(

07 Jun 2021, 15:16

Hi, could someone create a script that would allow me to: keep pressing the button on the side of my mouse, it would make me an autoclicker that would stop when I release the button (the number of clicks per second you want). It would be really nice because I've been trying to figure out how to do this for an hour but I just can't do it, Thanks a lot and goodbye. :)
User avatar
mikeyww
Posts: 26593
Joined: 09 Sep 2014, 18:38

Re: help for an autoclicker script please :(  Topic is solved

07 Jun 2021, 17:44

Code: Select all

XButton1::
While GetKeyState(A_ThisHotkey, "P")
 Send {%A_ThisHotkey%}
Return
Mouaz
Posts: 15
Joined: 07 Jun 2021, 14:52

Re: help for an autoclicker script please :(

08 Jun 2021, 03:22

Hello thanks a lot it worked !
It would be really great if you could create a script for my second button on the side of my mouse that would allow me to make a right click autoclicker by staying pressed on it.
Because the one you made allows me to make a left click autoclick but I would also like a right click autoclick with the second button on the side of my mouse, Thank you very much you don't know how much I am grateful to you ( by the way can you tell me how can i change the speed click of the autoclicker) !
User avatar
mikeyww
Posts: 26593
Joined: 09 Sep 2014, 18:38

Re: help for an autoclicker script please :(

08 Jun 2021, 05:43

Code: Select all

XButton1::autoClick("X1", 50)         ; Click XButton1 at 50 clicks per second (cps)
XButton2::autoClick("R")              ; Button can be L, R, M, X1, or X2

autoClick(button, cps := 100) {       ; Default cps = 100
 SetMouseDelay, 1000 / cps            ; Delay (ms) after each click
 While GetKeyState(A_ThisHotkey, "P") ; While the key is held,
  Click, %button%                     ;  ... click the specified button
}
Mouaz
Posts: 15
Joined: 07 Jun 2021, 14:52

Re: help for an autoclicker script please :(

08 Jun 2021, 06:43

hey sorry for disturbing you but i don't get it, i can't change the cps, im very new in this "autohotkey" programm so can you be more precise ?
should i write all what you sent from yesterday or only this ? :((
User avatar
mikeyww
Posts: 26593
Joined: 09 Sep 2014, 18:38

Re: help for an autoclicker script please :(

08 Jun 2021, 07:01

Here is an example with 10 clicks per second. You can try it in Notepad.

Code: Select all

XButton2::autoClick("R", 10)          ; XButton2 clicks the right button at 10 clicks per second

autoClick(button, cps := 100) {       ; Default cps = 100
 SetMouseDelay, 1000 / cps            ; Delay (ms) after each click
 While GetKeyState(A_ThisHotkey, "P") ; While the key is held,
  Click, %button%                     ;  ... click the specified button
}
I cannot control how your game may respond to this. Tips for games helps some people with their gaming issues.

https://autohotkey.com/board/topic/111737-how-to-make-ahk-work-in-most-games-the-basics/

An alternative to the SetMouseDelay is a Sleep that follows each click.
Mouaz
Posts: 15
Joined: 07 Jun 2021, 14:52

Re: help for an autoclicker script please :(

08 Jun 2021, 07:07

oh i got it its maybe because of my mouse software, nevermind you helped me a lot thank you
Mouaz
Posts: 15
Joined: 07 Jun 2021, 14:52

Re: help for an autoclicker script please :(

08 Jun 2021, 07:19

omg i finally got it im so happy, thank you very much i love you ( btw it was for minecraft) thanksssss !!! <3
Mouaz
Posts: 15
Joined: 07 Jun 2021, 14:52

Re: help for an autoclicker script please :(

15 Jun 2021, 06:25

hi again,
im trying to change it to 18-19 cps but i can't can you help me ?
User avatar
mikeyww
Posts: 26593
Joined: 09 Sep 2014, 18:38

Re: help for an autoclicker script please :(

15 Jun 2021, 07:04

Change 10 to 18.
Mouaz
Posts: 15
Joined: 07 Jun 2021, 14:52

Re: help for an autoclicker script please :(

15 Jun 2021, 07:29

I tried this but i get only 7-8 cps :

Code: Select all

XButton2::autoClick("L", 18)          

autoClick(button, cps := 100) {       
 SetMouseDelay, 1000 / cps            
 While GetKeyState(A_ThisHotkey, "P") 
  Click, %button%                   
}
[Mod edit: [code][/code] tags added.]
Mouaz
Posts: 15
Joined: 07 Jun 2021, 14:52

Re: help for an autoclicker script please :(

15 Jun 2021, 08:06

And how can I change the cps in this script ?
User avatar
Hellbent
Posts: 2102
Joined: 23 Sep 2017, 13:34

Re: help for an autoclicker script please :(

15 Jun 2021, 08:23

Mouaz wrote:
15 Jun 2021, 08:06
And how can I change the cps in this script ?
To change the click speed you press the "Click Speed" button and then adjust the min and max to the values you want. So if you wanted to click 18 times per second you can set both Min and Max to a value of 18 (if you hold shift while you adjust a slider it moves both at the same time.)

It uses the Left and Right mouse buttons to start clicking but they can be changed to other keys.

For left click go to these two lines and change the key to the hotkey you want to hold to click.


;***********************
Line 552

Code: Select all

While(GetKeyState("LButton","P")){

;Change to

While(GetKeyState("XButton2","P")){

And Line 585

Code: Select all

~$LButton::

;change to 

~$XButton2::
User avatar
mikeyww
Posts: 26593
Joined: 09 Sep 2014, 18:38

Re: help for an autoclicker script please :(

15 Jun 2021, 08:31

My earlier script has some inherent limitations in how Click is executed. In addition, the cps is only an estimate and is not accurate. If you raise the number quite a bit, you might get up to 30 cps or so. You could try Hellbent's method to see if that is more effective.
User avatar
Hellbent
Posts: 2102
Joined: 23 Sep 2017, 13:34

Re: help for an autoclicker script please :(

15 Jun 2021, 08:40

@mikeyww

Your approach was quite clever, the only problem with using SetMouseDelay is that if you are moving your cursor around and you are only doing a few clicks per second you can end up dragging things rather than just doing a simple click. Never the less, I'll def keep that one in mind in the future.

:thumbup:

Because my clicker is designed to use low click speeds and because ahk sleep times aren't very reliable I use a short sleep time and then check if the right amount of time has passed and any difference gets knocked off the next click. Over all, my testing has shown it to give near perfect results (averaging over a few clicks).
User avatar
mikeyww
Posts: 26593
Joined: 09 Sep 2014, 18:38

Re: help for an autoclicker script please :(

15 Jun 2021, 08:48

Thank you, Hellbent. That is a good point about the mouse delay; a Sleep would be less troublesome for that script instead of the mouse delay. Regardless, it sounds like your script is much more accurate anyway.
User avatar
Hellbent
Posts: 2102
Joined: 23 Sep 2017, 13:34

Re: help for an autoclicker script please :(

15 Jun 2021, 10:09

@Mouaz


looks like you deleted your last post.

I'll post my reply in the case anyone else has the same problem you were. (in regards to changing the click toggle hotkey)
Mouaz wrote:
15 Jun 2021, 09:24
hey on the line 552 i see the "While(GetKeyState("LButton","P")){" but not the "change to", should i type it myself ? and same for the line 585 (yes I have never done any programming in my life)
:)

What I was trying to inform you to do is replace this code found at line 552

Code: Select all

While(GetKeyState("LButton","P")){
with this code

Code: Select all

While(GetKeyState("XButton2","P")){
and then at line 585 replace this code:

Code: Select all

~$LButton::
With this code:

Code: Select all

~$XButton2::

Just in case you don't understand how the clicker works, here is how you use it.
*After you replace that code.

1: Run the script and press the "Hotkeys" button.

2: Select "Left" at the top and then where it says "ctrl + F1" you can change the activation hotkey. (click in that box and change it to a key you want). That hotkey is what turns the clicker on and off (All that it does is turns on and off your XButton2 hotkey so you can start clicking).

3: Press Update and then at the main screen press the "Click Speed" button and set the cps you want.

4. Press the hotkey you set in step 2 (ctrl + F1 by default). Press and hold XButton2 to start clicking.

5. Press the hotkey again to turn it off.

6. Do 4 and 5 as many times as you want.


You can tell if it is active by looking at the animation. If the animation is off, the clicker is on.
lalakayn
Posts: 2
Joined: 05 Apr 2022, 21:59

Re: help for an autoclicker script please :(

05 Apr 2022, 22:26

hi pls help me out i need a autoclicker script so when i hold my right mouse button it starts clciking 20 cps and when i release it stops clicking pls i want it to work in minecraft
User avatar
Hellbent
Posts: 2102
Joined: 23 Sep 2017, 13:34

Re: help for an autoclicker script please :(

06 Apr 2022, 00:40

lalakayn wrote:
05 Apr 2022, 22:26
hi pls help me out i need a autoclicker script so when i hold my right mouse button it starts clciking 20 cps and when i release it stops clicking pls i want it to work in minecraft
If you are using Windows 8 or 10 you can try this:
viewtopic.php?f=19&t=89335

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 57 guests