Rapid Fire (SchnellFeuer) for AHK v2, LeftMouse with Toggle On/Off and On/Off Sound , auto clicker , button repeater

Post gaming related scripts
Tobgun1
Posts: 123
Joined: 23 Feb 2023, 07:28

Rapid Fire (SchnellFeuer) for AHK v2, LeftMouse with Toggle On/Off and On/Off Sound , auto clicker , button repeater

Post by Tobgun1 » 27 Mar 2023, 05:39

Hello, a High Frequently asked Question and seach at Google is Rapid Fire / RapidFire (Schnellfeuer) or AutoFire (Automatisches Feuern), Auto Clicker, Button Repeater.

Most of Stuff i have found was AHKv1 or different Versions, so i wanna comply them togheter here!
i want to thank DuckingQuack for its 24/7 Job on me :D, and Mikeyww for hes outstanding performance in here, additional thanks to people like boiler and Datapoint wich i have met on my Road to AHK Heaven :xmas:
some Stuff is edited or Adapted, Parts used or Copy and Paste, so if i forgot something ping me and ill change it :)

Note: Those Scripts are not my own Work i did get lots of Help too, and i am not Sure if those incredible Tutors wanna get Noted here, so i Post them in my Name to provide em Online if a Search might Lead people to here in the Future

with some Slightly knowledge the Buttons can be changed easily!!

Probably ur specific game might not liek the "FireRate" of the repeating Commando, so it might be necessary to "SLOW IT DOWN" by increasing the ms between the Commands example "SetKeyDelay 25, 25" it means the commando gets Send in 25ms speed and the Button/Key itself gets Pressed (hold) for 25ms

Most Tests i made been good with around 15 to 25 ms, so 25ms is the "safePoint"

WARNING!!! i read about FireRates under 25ms wich could occur game Laggs, Chrashes and more, due to the fact your computer cant load the animations as fast as you are triggering them (some games got weapons with no realitisc fire rate)

usually ur FireRate on the Weapon gets Capped, like example: Gun xy, FireRate 1RPS (Round Per Second / Bullet Per Second)

Start Process: Install AHKv2 , Load the Script or Copy it into a Notepad, safe it as blablabla.ahk, double click the script so it is running.

Additional Note: some version might not work or even occur errors when used in scripts with other parts , so sometimes u need to decide wich one matches and if it fits into your script. so usually as stand alone they are all working.

so here are the Versions:

Code: Select all

; This is the second autoclicker ever made; all royalties to mikeyww, please
#Requires AutoHotkey v2.0
auto := False

CapsLock:: {
 Global auto := !auto
 SoundBeep 1000 + 500 * auto
}

#HotIf auto
LButton:: {
 SetKeyDelay 20, 20
 While GetKeyState(ThisHotkey, "P")
  SendEvent '{' ThisHotkey '}'
}
#HotIf
F10::ExitApp
Explanation: with CapsLock (Feststelltaste) u can Toggle On/Off the RapidFire of the Left Mouse Button, a Sound Beep gives you an acoustic feedback if u triggered it on or off
LetftButton gets triggered in 20ms Speed while u keep your mouse button pressed down
if you want to close the script or got some errors u can F10 exit it

so:

Code: Select all

CapsLock::
and

Code: Select all

LButton::
and

Code: Select all

SetKeyDelay 20, 20
, can be changed to any Key, and to speed like 15, 15 or even faster (if game and/or CPU can Handle it)


German Sound Version ofthe Same Script:

Code: Select all

#Requires AutoHotkey v2.0
#SingleInstance Force
rapid := False

CapsLock:: {
 Global rapid := !rapid
 ComObject('SAPI.SpVoice').Speak('SchnellFeuer ' (rapid ? 'Aktiviert' : 'Deaktiviert'))
}

#HotIf rapid
LButton:: {
 SetKeyDelay 20, 20
 While GetKeyState(ThisHotkey, "P")
 SendEvent '{' ThisHotkey '}'
}
#HotIf

F10:: ExitApp

Version 2:

Code: Select all

#Requires AutoHotkey v2.0
#SingleInstance Force
InstallKeybdHook
InstallMouseHook

on := False

F6:: {
 Global on := !on
 SoundBeep 1000 + 500 * on 
}
#HotIf on
~$LButton:: {
    While GetKeyState("LButton", "P") {
    Sleep(25)
    Click
    Sleep(25)
    }
}
#HotIf


F10:: ExitApp
Explanation: here it is a different Hotkey to Toggle On/Off, a Smarter Sound "Soundbeep" and a different way if Left Mouse Click "Click" and Delay command "Sleep", Note: most Pro Coders dont like Sleep in their scripts, due to the fact it can pause the whole script, here as single code block it shouldbe okay, and maybe can give a different way if version 1 doesnt works


Version 3:

Code: Select all

#Requires AutoHotkey v2.0
#SingleInstance Force
InstallKeybdHook
InstallMouseHook

on := False

CapsLock:: {
 Global on := !on
 SoundBeep 1000 + 500 * on 
}
#HotIf on
~$LButton:: {
    While GetKeyState("LButton", "P") {
    Click ("D")
    Sleep(20)
    Click ("U")
    Sleep(20)
    }
}
#HotIf

F10:: ExitApp
Explanation: it seems my specific game didnt liked "LButton" or "Click" as those been a single mouse click and not the combnation of "Press and Release" a Button, so i made this version by my own with a press button (down) "Click D" and a release button (Up) "Click U" i am not sure i think i could change "sleep" into SetKeyDelay, wich would be better tho...

if anyone wants to comment or correct me you are free to do :) i am not a professional, and i might have errors in here aswell.

Greetings Tobgun1
Last edited by Tobgun1 on 03 Apr 2023, 19:58, edited 4 times in total.

Tobgun1
Posts: 123
Joined: 23 Feb 2023, 07:28

Re: Rapid Fire (SchnellFeuer) for AHK v2, LeftMouse with Toggle On/Off and On/Off Sound

Post by Tobgun1 » 27 Mar 2023, 19:09

Here is a Left Mouse Button "RapidFire" , using the Mouse Side Button Number 4 (XButton1), so you can Shoot normal with the Left Mouse Click, and RapidFire with the Thumb-Sided Button
(Note: as usually in my Script Versions i use F10 for Exit The Script)

Code: Select all

#Requires AutoHotkey v2.0
#SingleInstance Force
InstallMouseHook
InstallKeybdHook

XButton1:: {
 SetKeyDelay 20, 20
 While GetKeyState(ThisHotkey , "P")
 SendEvent '{LButton}'
}
F10:: ExitApp

and another Version (4) :D , made by my AMAZING Tudor :)

This One is again a Toggle On/Off with Sound Feedback, avoided Sleep and KeyDelay by a Timer.
CapsLock for Left Button RapidFire

sadly only the Real Professionals could tell wich one is the better one, but well, all are working in some kind :)

Code: Select all

; adapted and created with Help from DuckingQuak, in testing and Design.
]#Requires AutoHotkey v2.0
#SingleInstance Force
InstallMouseHook
InstallKeybdHook
SendMode "Event"
Thread "Interrupt", 0
Esc::ExitApp

XButton1:: {
    Static on := False
    Critical "On"
    SetTimer(FnClicks, 25 * on := !on, 100)
    ComObject('SAPI.SpVoice').Speak('RapidFire ' (on ? 'Aktiviert' : 'Deaktiviert'))
   }
FnClicks() {
    Critical "On"
    If GetKeyState("LButton", "P") {
    Send "{Click}"
   }}
Last edited by Tobgun1 on 30 Mar 2023, 21:05, edited 2 times in total.

Tobgun1
Posts: 123
Joined: 23 Feb 2023, 07:28

Re: Rapid Fire (SchnellFeuer) for AHK v2, LeftMouse with Toggle On/Off and On/Off Sound , auto clicker , button repeater

Post by Tobgun1 » 30 Mar 2023, 20:59

Here is a Playstation 4 #PS4 , DualShock 4 #DS4 Rapidfire for Left Mouse Button, ! this means: the script is using the Controller Keys to do actions, reads them BUT! it uses Keyboard and Mouse to send its actions.
So this works only in games wich accept this kind of solution!
There is no AHK Solution to Send JoyStick / Controller / XBox Buttons , i might refer you to DS4Windows or maybe XPadder to find possible Solutions
In my Game this works for me

Code: Select all

#Requires AutoHotkey v2.0
#SingleInstance Force
InstallMouseHook
InstallKeybdHook
SendMode "Event"
; Note Double Keys did occur Errors, so if u are using Controller Fire-Key (in my example R2), togheter with Mouse Fire Key (in my example Left Mouse Button)
; to realise a RapidFire Function,
; then u have to "Unbind" the "R2" in Controller Settings, so the Signal is not send Double to the Game
; i changed at Keyboard´n Mouse Settings "Left Mouse Button for Melee Attack" to a Random free Button ("V"), 
; and in Contrl Settings "R2 for Shoot" to the Empty Slot i found "D-Pad Down"


Joy11:: { ; DualShock4 Button "L3" for Toggle On Off the Variable and play the Sound
     Static on := False
     SoundPlay A_ScriptDir (on ? '\Gun Mode On.mp3' : '\Gun Mode Off.mp3')
     SetTimer(RapidFireController, 25 * on := !on)
}

Joy8:: { ; DS4 "R2" Button
    Send '{LButton Down}' ; Choosen this to prevent the "GhostBullets" Error somehow
    Sleep(30) ; Unclear why other Sends like "Click" occur the "GhostBullets" Error in "SpacePunks" yet
    Send '{LButton Up}'
}

RapidFireController() { ; DS4 "R2" RapidFire Part (Using Left Mouse Button "LButton")
    If GetKeyState("Joy8", "P") {
     Send "{LButton}" ; in RapidiFire Mode this works on Single Fire i get Ghost Bullets
   }
}

F10::ExitApp
Note: at the Attachments i made a zip-folder for the very nice Gun Sounds for on off switching between the "fire Modes" , inside it is a german explanation and the script itself
Attachments
RapidFire PS4 DualSchock - Gun Sound.zip
(57.22 KiB) Downloaded 100 times

Noitalommi_2
Posts: 194
Joined: 16 Aug 2023, 10:58

Re: Rapid Fire (SchnellFeuer) for AHK v2, LeftMouse with Toggle On/Off and On/Off Sound , auto clicker , button repeater

Post by Noitalommi_2 » 17 Aug 2023, 05:53

Here's a script I use when I'm too lazy to constantly click the left mouse button, it allows single and automatic clicks.
You can change the threshold and the click rate in ms.
F4 is to toggle the hotkey and to exit the script.
You can test this script here: Click Counter

Code: Select all

#Requires AutoHotkey >=2.0
#Warn
#SingleInstance

; F4 = toggle Hotkey on/off, holding = Exit

T := Threshold := 125 ; continuous clicking after 125ms
C := ClickRate := 250 ; click every 250ms

*LButton::{
	A := A_TickCount, MouseClick()
	While GetKeyState("LButton", "P"){
		if A_TickCount - A > T{
			Sleep(C - T < 0 ? 0 : C - T)
			While GetKeyState("LButton", "P")
				MouseClick(), Sleep(C)
		}
	}
}
#SuspendExempt
F4::KeyWait(ThisHotkey, "T.5") ? Suspend(-1) : ExitApp()
Last edited by Noitalommi_2 on 23 Aug 2023, 10:31, edited 3 times in total.


ElderGodPat
Posts: 1
Joined: 29 Sep 2023, 02:20

Re: Rapid Fire (SchnellFeuer) for AHK v2, LeftMouse with Toggle On/Off and On/Off Sound , auto clicker , button repeater

Post by ElderGodPat » 15 Oct 2023, 09:22

How can I add an "auto reload" function to this script? Ex. I want the "R" button pushed after releasing left-click.

Goose82663
Posts: 3
Joined: 10 Nov 2023, 21:14

Re: Rapid Fire (SchnellFeuer) for AHK v2, LeftMouse with Toggle On/Off and On/Off Sound , auto clicker , button repeater

Post by Goose82663 » 15 Jan 2024, 04:49

What changes would need to be made to change this from LeftMouse to SpaceBar?

Post Reply

Return to “Gaming”