Im trying to make a autoclicker that clicks when you hold
Im trying to make a autoclicker that clicks when you hold
I know that there are forums for pretty much the same thing but for some reason, they only work half of the time when I hold in Minecraft. If anyone knows a way around this then please tell me, your help will be appreciated!
Re: Im trying to make a autoclicker that clicks when you hold
Games can be finicky. Hard to know what to try differently without seeing the code you've tried.
Try this:
Try this:
Code: Select all
*LButton::HoldClick()
HoldClick()
{
(enable := GetKeyState('LButton', 'P')) ? SendEvent('{Click}') : 0
SetTimer(HoldClick, -50 * enable)
}
Re: Im trying to make a autoclicker that clicks when you hold
It does work! Thank you for the script
Re: Im trying to make a autoclicker that clicks when you hold
Code: Select all
~*XButton2::
While GetKeyState("XButton2","P")
{
Click
}
Return
- Theleifblower
- Posts: 12
- Joined: 16 May 2024, 16:12
Re: Im trying to make a autoclicker that clicks when you hold
is there a way to modify this to work with a key like f on my keyboard, so while i hold down f its pressed repeatedly until i release itniCode wrote: ↑21 Nov 2023, 16:14Games can be finicky. Hard to know what to try differently without seeing the code you've tried.
Try this:Code: Select all
*LButton::HoldClick() HoldClick() { (enable := GetKeyState('LButton', 'P')) ? SendEvent('{Click}') : 0 SetTimer(HoldClick, -50 * enable) }
Re: Im trying to make a autoclicker that clicks when you hold
Try:
Code: Select all
*LButton::SpamKey()
*f::SpamKey()
SpamKey()
{
key := SubStr(A_ThisHotkey, 2)
Spam := SendEvent.Bind('{' key '}')
SetTimer(Spam, 50)
KeyWait(key)
SetTimer(Spam, 0)
}
- Theleifblower
- Posts: 12
- Joined: 16 May 2024, 16:12
Re: Im trying to make a autoclicker that clicks when you hold
niCode wrote: ↑16 May 2024, 17:05Try:
Code: Select all
*LButton::SpamKey() *f::SpamKey() SpamKey() { key := SubStr(A_ThisHotkey, 2) Spam := SendEvent.Bind('{' key '}') SetTimer(Spam, 50) KeyWait(key) SetTimer(Spam, 0) }
works, if you have the time could you explain to me how this works? it makes very little sense to me (im a complete beginner to programing)
- Theleifblower
- Posts: 12
- Joined: 16 May 2024, 16:12
Re: Im trying to make a autoclicker that clicks when you hold
niCode wrote: ↑16 May 2024, 17:05Try:
Code: Select all
*LButton::SpamKey() *f::SpamKey() SpamKey() { key := SubStr(A_ThisHotkey, 2) Spam := SendEvent.Bind('{' key '}') SetTimer(Spam, 50) KeyWait(key) SetTimer(Spam, 0) }
actually no its not working, it works amazing in text and browsers but not in the game i intended to use it in, are there any things i can try to make it work in this game?
Re: Im trying to make a autoclicker that clicks when you hold
You could try running the script as administrator or otherwise address UAC.
- Theleifblower
- Posts: 12
- Joined: 16 May 2024, 16:12
Re: Im trying to make a autoclicker that clicks when you hold
No, if that were the issue, it really shouldn’t work at all, so it must be like a lot of games that it only responds to physical keystrokes, not virtual ones.
- Theleifblower
- Posts: 12
- Joined: 16 May 2024, 16:12
Re: Im trying to make a autoclicker that clicks when you hold
is there a way to get around this? Ive seen cases where using up and down key commands fixes similar issues? is there a way to integrate those into this script if that is something worth trying?
Code: Select all
#Requires AutoHotkey v2.0
*f::SpamKey()
SpamKey()
{
key := SubStr(A_ThisHotkey, 2)
Spam := SendEvent.Bind('{' key '}')
SetTimer(Spam, 50)
KeyWait(key)
SetTimer(Spam, 0)
}
Last edited by joedf on 16 May 2024, 18:36, edited 1 time in total.
Reason: fix [code] tags
Reason: fix [code] tags
Re: Im trying to make a autoclicker that clicks when you hold
You can try this just in case:
Code: Select all
#Requires AutoHotkey v2.0
*f::SpamKey()
SpamKey() {
key := SubStr(A_ThisHotkey, 2)
Spam := SendDownUp.Bind(key)
SetTimer(Spam, 50)
KeyWait(key)
SetTimer(Spam, 0)
SendDownUp(k) {
Send '{' k ' down}'
Sleep 20
Send '{' k ' up}'
}
}
- Theleifblower
- Posts: 12
- Joined: 16 May 2024, 16:12
Re: Im trying to make a autoclicker that clicks when you hold
boiler wrote: ↑16 May 2024, 19:43You can try this just in case:Code: Select all
#Requires AutoHotkey v2.0 *f::SpamKey() SpamKey() { key := SubStr(A_ThisHotkey, 2) Spam := SendDownUp.Bind(key) SetTimer(Spam, 50) KeyWait(key) SetTimer(Spam, 0) SendDownUp(k) { Send '{' k ' down}' Sleep 20 Send '{' k ' up}' } }
THAT WORKS!!!
manny thanks, though if you have the time id love it if you could try to explain to me how it works
Re: Im trying to make a autoclicker that clicks when you hold
Here's the code with comments. Let us know if you have any other questions.Theleifblower wrote: ↑16 May 2024, 20:04though if you have the time id love it if you could try to explain to me how it works
Code: Select all
#Requires AutoHotkey v2.0
*f::SpamKey() ; Wildcard modifier * lets the key work even when holding down a modifier key i.e. Shift, Ctrl, Alt, Win
SpamKey() {
key := SubStr(A_ThisHotkey, 2) ; When *f is pressed, A_ThisHotkey is *f. SubStr is returning the string starting at the second position (f)
Spam := SendDownUp.Bind(key) ; Binds a value to a function that can be called later. When it is called later, the parameter is automatically inserted for you
; Spam := () => SendDownUp(key) ; Alternative to above line if it makes more sense to you. Uses a fat-arrow function to call a function with a specific parameter
SetTimer(Spam, 50) ; Start a timer that calls a function every 50ms
KeyWait(key) ; Wait for the key pressed to be released
SetTimer(Spam, 0) ; Turn off the timer
SendDownUp(k) {
Send '{' k ' down}' ; Send key down
Sleep 20 ; Wait 20ms
Send '{' k ' up}' ; Send key up
}
}
- Theleifblower
- Posts: 12
- Joined: 16 May 2024, 16:12
Re: Im trying to make a autoclicker that clicks when you hold
thanks! i actually do have some other questions, im trying make a different macro it should show up as a topic in ask for help v2 (sub category of gaming) if you'd be willing to help that'd be greatniCode wrote: ↑16 May 2024, 20:32Here's the code with comments. Let us know if you have any other questions.Theleifblower wrote: ↑16 May 2024, 20:04though if you have the time id love it if you could try to explain to me how it works
Code: Select all
#Requires AutoHotkey v2.0 *f::SpamKey() ; Wildcard modifier * lets the key work even when holding down a modifier key i.e. Shift, Ctrl, Alt, Win SpamKey() { key := SubStr(A_ThisHotkey, 2) ; When *f is pressed, A_ThisHotkey is *f. SubStr is returning the string starting at the second position (f) Spam := SendDownUp.Bind(key) ; Binds a value to a function that can be called later. When it is called later, the parameter is automatically inserted for you ; Spam := () => SendDownUp(key) ; Alternative to above line if it makes more sense to you. Uses a fat-arrow function to call a function with a specific parameter SetTimer(Spam, 50) ; Start a timer that calls a function every 50ms KeyWait(key) ; Wait for the key pressed to be released SetTimer(Spam, 0) ; Turn off the timer SendDownUp(k) { Send '{' k ' down}' ; Send key down Sleep 20 ; Wait 20ms Send '{' k ' up}' ; Send key up } }
Who is online
Users browsing this forum: No registered users and 3 guests