Script for autofire

Ask gaming related questions (AHK v1.1 and older)
jacohawk
Posts: 5
Joined: 23 Aug 2017, 03:56

Script for autofire

Post by jacohawk » 23 Aug 2017, 04:55

I'm trying to make a simple script that autofires (press LButton) only while holding RButton.
So, if I press LButton nothing happens, but if I press RButton and then LButton it autofires.
Can Anyone help me? :)

I have this script that works while LButton is holding:

Code: Select all

~$*LButton::			; Fires Automaticly when Autofire is on.
		if V_AutoFire = 1
	{
		Loop
	{
		GetKeyState, LButton, LButton, P
		if LButton = U
			Break
		MouseClick, Left,,, 1
		Gosub, RandomSleep
	}
	}
	Return 
Last edited by jacohawk on 23 Aug 2017, 06:16, edited 1 time in total.

User avatar
Reloaded
Posts: 283
Joined: 25 Aug 2017, 08:48

Re: Script for autofire

Post by Reloaded » 27 Aug 2017, 08:48

Hi! :D

Code: Select all

#MaxThreadsperHotkey 2
RButton:: ;Here can you change which key it will toggle.
toggle := !Toggle
loop
{
if toggle
{
Click, X%xpos% Y%ypos%.
}

else
	break
}
return
I make a toggle, so you make right click and it make rapid fire Clicking by your mouse position and if you want stop it click again right button

SvenBent
Posts: 266
Joined: 09 Aug 2015, 01:34

Re: Script for autofire

Post by SvenBent » 03 Sep 2017, 00:11

Code: Select all

#if GetKeyState("ScrollLock","T")

LButton::
SetTimer MouseSpam, 99
Return

LButton up::
SetTimer MouseSpam, off
Return

#if

MouseSpam:
Click
Return
this just make the left mouse button have aturbo mode if scroll lock is activated
modify as you see fit

User avatar
Reloaded
Posts: 283
Joined: 25 Aug 2017, 08:48

Re: Script for autofire

Post by Reloaded » 03 Sep 2017, 14:55

SvenBent wrote:

Code: Select all

#if GetKeyState("ScrollLock","T")

LButton::
SetTimer MouseSpam, 99
Return

LButton up::
SetTimer MouseSpam, off
Return

#if

MouseSpam:
Click
Return
this just make the left mouse button have aturbo mode if scroll lock is activated
modify as you see fit

This dont Work

SvenBent
Posts: 266
Joined: 09 Aug 2015, 01:34

Re: Script for autofire

Post by SvenBent » 06 Oct 2017, 20:42

Reloaded wrote:
SvenBent wrote:

Code: Select all

#if GetKeyState("ScrollLock","T")

LButton::
SetTimer MouseSpam, 99
Return

LButton up::
SetTimer MouseSpam, off
Return

#if

MouseSpam:
Click
Return
this just make the left mouse button have aturbo mode if scroll lock is activated
modify as you see fit

This dont Work

Works perfectly. you must be doing something wrong.

User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Script for autofire

Post by Xtra » 06 Oct 2017, 22:29

Code: Select all

~RButton::AutoFire := 1
~RButton Up::AutoFire := 0

#If (AutoFire)
LButton::
    while GetKeyState("LButton","P")
    {
        Click
        RandomSleep()
    }
return
#If

RandomSleep(min:=20,max:=70)
{
    Random, rnd, min, Max
    Sleep rnd
}
HTH

Post Reply

Return to “Gaming Help (v1)”