autoclicker
-
- Posts: 1
- Joined: 28 Mar 2023, 20:58
autoclicker
I need a hotkey that gets 14-15 cps on right click but i click q to activate it and q to turn it off
Re: autoclicker
Welcome to this AutoHotkey forum!
Code: Select all
; This is the third autoclicker ever made; all royalties to mikeyww, please
#Requires AutoHotkey v2.0
cps := 14
on := False
q:: {
Global on := !on
SoundBeep 1000 + 500 * on
}
#HotIf on
RButton:: {
start := A_TickCount, cliks := 0
While GetKeyState(ThisHotkey, 'P') {
Click
Sleep start - A_TickCount + 1000 * ++cliks / cps
ToolTip 'CPS = ' Round(1000 * cliks / (A_TickCount - start))
}
ToolTip
}
#HotIf
- WalkerOfTheDay
- Posts: 710
- Joined: 24 Mar 2016, 03:01
Re: autoclicker
mikeyww wrote: ↑28 Mar 2023, 21:59Welcome to this AutoHotkey forum!
Code: Select all
; This is the third autoclicker ever made; all royalties to mikeyww, please
Re: autoclicker
Code: Select all
; This is the third autoclicker ever made; all royalties to mikeyww, please
#Requires AutoHotkey v2.0
cps := Random(8, 12)
on := False
q:: {
Global on := !on
SoundBeep 1000 + 500 * on
}
#HotIf on
RButton:: {
start := A_TickCount, cliks := 0
While GetKeyState(ThisHotkey, 'P') {
Click
Sleep start - A_TickCount + 1000 * ++cliks / cps
ToolTip 'CPS = ' Round(1000 * cliks / (A_TickCount - start))
}
ToolTip
}
#HotIf
[Mod edit: Removed the code from the quoted section because it’s not what mikeyww actually posted since you modified it.]
Re: autoclicker
No, actually, it doesn’t. Unless you think it should be random every time you press the hotkey as opposed to every time you run the script. Then you would need to put the part where it chooses the random value inside the hotkey function.
Re: autoclicker
Thanks for the quick reply! I tried this;
Code: Select all
#Requires AutoHotkey v2.0
on := False
q:: {
Global on := !on
SoundBeep 1000 + 500 * on
}
#HotIf on
RButton:: {
start := A_TickCount, cliks := 0
While GetKeyState(ThisHotkey, 'P') {
Click
Sleep start - A_TickCount + 1000 * ++cliks / Random(8, 12)
ToolTip 'CPS = ' Round(1000 * cliks / (A_TickCount - start))
}
ToolTip
}
#HotIf
Code: Select all
; This is the third autoclicker ever made; all royalties to mikeyww, please
#Requires AutoHotkey v2.0
on := False
cps := 8
cps2 := 10
q:: {
Global on := !on
SoundBeep 1000 + 500 * on
}
#HotIf on
Xbutton2:: {
start := A_TickCount, cliks := 0
While GetKeyState(ThisHotkey, 'P') {
Click
Sleep start - A_TickCount + 1000 * ++cliks / Random(cps, cps2)
ToolTip 'CPS = ' Round(1000 * cliks / (A_TickCount - start))
}
ToolTip
}
#HotIf
Re: autoclicker
Nominally, the Sleep delay would simply be based on the value of CPS, but including A_TickCount looks like it is meant to account for the fact that Sleep delays aren't very accurate so it adjusts based on actual performance to that point. @mikeyww might be in a better position to see how your modifications may impact his original code.
Re: autoclicker
This does not actually explain anything. It is unclear what should be randomized, and when.I tried to randomise it
The current script does already provide somewhat random sleep. You can check it to see what the sleep times are.
Code: Select all
; This is the third autoclicker ever made; all royalties to mikeyww, please
#Requires AutoHotkey v2.0
cps := 14
on := False
q:: {
Global on := !on
SoundBeep 1000 + 500 * on
}
#HotIf on
RButton:: {
start := A_TickCount, cliks := 0, tip := ''
While GetKeyState(ThisHotkey, 'P') {
Click
Sleep wait := Round(start - A_TickCount + 1000 * ++cliks / cps)
ToolTip tip .= wait '`n'
}
MsgBox 'CPS = ' Round(1000 * cliks / (A_TickCount - start))
}
#HotIf
Re: autoclicker
Dear Mikeyww!
Please send me a private message! I need your help.
Please send me a private message! I need your help.
Re: autoclicker
Welcome to this AutoHotkey forum! Feel free to send a message when you wish. Kunkunca, as a new user, you probably need to wait for moderator approval.
Re: autoclicker
Thank you for the help!boiler wrote: ↑13 Nov 2023, 09:47Nominally, the Sleep delay would simply be based on the value of CPS, but including A_TickCount looks like it is meant to account for the fact that Sleep delays aren't very accurate so it adjusts based on actual performance to that point. @mikeyww might be in a better position to see how your modifications may impact his original code.
I tried to make it more "human", which results in different CPS. For example when i personally do a CPS test i get between 7-9 CPS but whilst testing it can go down to 6 and then i click faster and it goes to 9, but then i get tired and it goes back down.. and so on. My take was that i compared it to an ahk script that i wrote for v1, which does the exact same but it has a more consistent "randomised" clicking. Anyway it was just for fun, since i have not yet gone over to v2. Thank you for the help a nice code!If you want a random CPS with every iteration (which probably does not make a lot of sense)
Re: autoclicker
If you do not need something "precise", you could simplify and just add a random sleep between consecutive clicks.
Code: Select all
#Requires AutoHotkey v2.0
RButton:: {
While GetKeyState(ThisHotkey, 'P')
Click(), Sleep(Random(15, 100))
}
Re: autoclicker
Exactly here was my v1 take on that! Thanks again!mikeyww wrote: ↑13 Nov 2023, 13:48If you do not need something "precise", you could simplify and just add a random sleep between consecutive clicks.
Code: Select all
#Requires AutoHotkey v2.0 RButton:: { While GetKeyState(ThisHotkey, 'P') Click(), Sleep(Random(15, 100)) }
Code: Select all
Click() {
Send {Click Left down}
Send {Click Left up}
random, time, 25, 80
Sleep, time
}
Return