LMB Rapid fire while hold LMB + f8 turning off

Ask gaming related questions (AHK v1.1 and older)
QuantumD0T
Posts: 7
Joined: 07 Jan 2018, 18:39

LMB Rapid fire while hold LMB + f8 turning off

07 Jan 2018, 18:55

Hi. I combined few codes to suite my needs, the only problem I think I have is that the script turns itself off (2nd while loop gets terminated on the "send, {lbutton up})

is it because AHK doesnt distinguish between hardware and its own outputs? What I am asking is "does the script thinks that the LMB was released even if its held down on my mouse?"

I would like to keep the trigger as LMB and not f8, is there a way around this problem?

Code: Select all

F8::
    While GetKeyState("F8", "P"){
    KeyWait lbutton, T0.5                 ; Wait 1/2 second for user to release key
    If ErrorLevel                   ; Still held down
        While GetKeyState("lbutton","p"){ ; While it is held down
		send, {lbutton down}
		RandSleep(45,60) ;sleep a random length of time
		send, {lbutton up}
		RandSleep(40,60) ;sleep a random length of time
        }
    
    }
return

RandSleep(x,y) {
Random, rand, %x%, %y%
Sleep %rand%
}
if this is a double post i appologize but I dont think I was logged in while I posted the previous one....
Rohwedder
Posts: 7630
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: LMB Rapid fire while hold LMB + f8 turning off

08 Jan 2018, 00:47

Hallo,
no problem. AHK distinguishes between hardware and its own outputs!
Try:

Code: Select all

~lbutton::
    While GetKeyState("lbutton", "P")
	{
		KeyWait lbutton, T0.5    ; Wait 1/2 second for user to release key
		If ErrorLevel            ; Still held down
			While GetKeyState("lbutton","P")
			{ ; While it is held down
				send, {lbutton down}
				RandSleep(45,60) ;sleep a random length of time
				send, {lbutton up}
				RandSleep(40,60) ;sleep a random length of time
			}    
    }
return

RandSleep(x,y)
{
	Random, rand, %x%, %y%
	Sleep %rand%
}

QuantumD0T
Posts: 7
Joined: 07 Jan 2018, 18:39

Re: LMB Rapid fire while hold LMB + f8 turning off

08 Jan 2018, 23:22

but that just removed the f8 entirely.... I put it there to make sure this LMB spam only happens when intended (when F8 is held down)
Rohwedder
Posts: 7630
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: LMB Rapid fire while hold LMB + f8 turning off

09 Jan 2018, 01:32

Hallo,
I did not know that, next try:

Code: Select all

F8::Return
~lbutton::
	While GetKeyState("lbutton","P")
	{ ; While it is held down
		If GetKeyState("F8","P")
		{
			send, {lbutton down}
			RandSleep(45,60) ;sleep a random length of time
			send, {lbutton up}
			RandSleep(40,60) ;sleep a random length of time
		}
	}
return

RandSleep(x,y)
{
	Random, rand, %x%, %y%
	Sleep %rand%
}
To keep the normal function of F8, remove the first line.
QuantumD0T
Posts: 7
Joined: 07 Jan 2018, 18:39

Re: LMB Rapid fire while hold LMB + f8 turning off

05 Mar 2018, 22:49

Thank you for reply, with some delay I came back to this project.

Thanks for help! I got everything to work just fine now.

Edit: Seems like the f8 is getting passed on at some point of the script.... is there a way to ensure it doesn't get passed on?

Edit2: I found the culprit:

Code: Select all

F8::Return
~lbutton::
	While GetKeyState("lbutton","P")
	{ ; While it is held down
	KeyWait lbutton, T0.5                 ; Wait 1/2 second for user to release key
    	If ErrorLevel                   ; Still held down
	send, {LCtrl down}
		While GetKeyState("F8","P")
		{
			send, {lbutton down}
			RandSleep(45,60) ;sleep a random length of time
			send, {lbutton up}
			RandSleep(40,60) ;sleep a random length of time
		}
	}
	send, {LCtrl up}
	

return

RandSleep(x,y)
{
	Random, rand, %x%, %y%
	Sleep %rand%
}
Since the f8 is getting blocked by itself it doesn't go through but because I require Ctrl pressed then the combo f8+ctr gets passed on. I tried both manually pressing Ctrl and like seen above within the script...

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 127 guests