Rapid fire scripft

Ask gaming related questions (AHK v1.1 and older)
mdrake1
Posts: 29
Joined: 18 Oct 2020, 07:15

Rapid fire scripft

07 May 2021, 11:49

I have a script for rapid fire but the guns shoot too slow. This is the one i have.

Code: Select all

\::Suspend
*LButton::
Loop
{
SetMouseDelay 1
Click
If (GetKeyState("LButton","P")=0)
Break
}
[Mod edit: [code][/code] tags added.]

I tried to setmousedelay 0 but that freezes the game.
I had one that was fine but i can't find it now.
User avatar
mikeyww
Posts: 26871
Joined: 09 Sep 2014, 18:38

Re: Rapid fire scripft

07 May 2021, 12:44

You might gain a few ms if you SetBatchLines.
User avatar
jasc2v8
Posts: 59
Joined: 10 Dec 2020, 12:24
Contact:

Re: Rapid fire scripft

07 May 2021, 12:59

I run Win10 Home with an i7 CPU and I measure about 15-16 ms between clicks.
Why is this "too slow" and what would an acceptable rate be?
Even if your game runs at 120 FPS, this seems pretty fast to me.
I tried various combinations of SetMouseDelay -1, 0, 1 and #InstallMouseHook etc.

This is a hack to check timing.
Run the script, click the mouse and hold for a second, press Escape to end the script, then read the values in the text file.
If your timing is signficanlty slower, it may not be anything with AHK code.

Code: Select all

#NoEnv
; #Warn
SendMode Input
SetWorkingDir %A_ScriptDir%
SetBatchLines, -1
ListLines, Off
#SingleInstance, Force

#InstallKeybdHook
#InstallMouseHook
#UseHook

FileDelete, RapidFireScript.txt

StartTime := A_TickCount

*LButton::
SetMouseDelay 0
Loop
{
  Click
  If (GetKeyState("LButton","P")=0)
    Break
  ElapsedTime := A_TickCount - StartTime
  StartTime := A_TickCount
  if (ElapsedTime > 10)
    FileAppend, % ElapsedTime . "`n", RapidFireScript.txt
}
Return

ExitApp
Escape::ExitApp
mdrake1
Posts: 29
Joined: 18 Oct 2020, 07:15

Re: Rapid fire scripft

07 May 2021, 14:25

Thanks

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 63 guests