XIM Community

Rapid Fire written in AHK not smooth nor consistent  (Read 5857 times)

Offline name294

  • Member
  • *
  • Posts: 19
    • View Profile
Hello, I've recently started experimenting with AHK scripts on sandhawC. My sandhawC displays my polling rate at a steady 125 Hz, 8 ms, unless I rapidly click my right mouse button.

I know that the xim4 has inconsistency with running rapid/complex commands on scripts, so I decided to play around with sandhawC and test out the easiest script to run: rapid-fire.

My test program:

Code: [Select]
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#UseHook ;
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

Ins::Suspend
LButton::
Loop
{
Click
Sleep, 10

If (GetKeyState("LButton","P")=0)
Break
}

I've changed the sleep time around many times and it always fires any semi-auto gun too slowly and inconsistently. I know that spamming clicks isn't a good idea since the xim4 has a polling rate of 8 ms.
 But even when I change the sleep time to a massive 1000 (1 second), the fire rate is still inconsistent!

How can I make it fast and smooth for xim4? It runs and tests smooth on Windows, but that's expected.

Offline name294

  • Member
  • *
  • Posts: 19
    • View Profile
Re: Rapid Fire written in AHK not smooth nor consistent
« Reply #1 on: 11:58 PM - 05/15/16 »
Okay, so I made some adjustments to my first attempt.
I realized that there was too many commands being inputted to the xim4 without the proper 8 ms wait time. Especially between mouse up and mouse down.

This is my new code, which is now consistent and has a much faster rapid fire.

Code: [Select]
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#UseHook
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.


~LButton::

while(GetKeyState("LButton","P")=1) {
Sleep, 27
Click down
Sleep, 27
Click up
}
return

I pretty much switched a g18 in battlefield 4 to single fire and could not tell the difference between that and full auto. If anyone here has got a even faster rapid fire written, please let me know. :)

However, still tons of problems to fix. Rapid fire is an easy script to write, but I could not get auto mouse move to be consistent. Seems like everytime I use DllCall with mouse_event, xim4 has different results everytime.
« Last Edit: 02:05 AM - 05/16/16 by name294 »

Offline tails72

  • MVP
  • *
  • Posts: 528
    • View Profile
Re: Rapid Fire written in AHK not smooth nor consistent
« Reply #2 on: 01:36 AM - 05/16/16 »
Wouldn't it be easier to just have a mouse that you can use macros on, like the bloody series?

Offline name294

  • Member
  • *
  • Posts: 19
    • View Profile
Re: Rapid Fire written in AHK not smooth nor consistent
« Reply #3 on: 02:07 AM - 05/16/16 »
Wouldn't it be easier to just have a mouse that you can use macros on, like the bloody series?

But doesn't the bloody mouse DPI cap at 3,200?

I'm a player who plays on high sensitivity and I tried 3,200 DPI and could not get my mouse to move nearly as fast as I wanted. I use the logitech G502 with 12,000 DPI and I love it for the high sensitivity.

Offline name294

  • Member
  • *
  • Posts: 19
    • View Profile
Re: Rapid Fire written in AHK not smooth nor consistent
« Reply #4 on: 02:09 AM - 05/16/16 »
Okay, so I made some adjustments to my first attempt.
I realized that there was too many commands being inputted to the xim4 without the proper 8 ms wait time. Especially between mouse up and mouse down.

This is my new code, which is now consistent and has a much faster rapid fire.

Code: [Select]
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#UseHook ; Because Od1n said so
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.


~LButton::

while(GetKeyState("LButton","P")=1) {
Sleep, 27
Click down
Sleep, 27
Click up
}
return

I pretty much switched a g18 in battlefield 4 to single fire and could not tell the difference between that and full auto. If anyone here has got a even faster rapid fire written, please let me know. :)

However, still tons of problems to fix. Rapid fire is an easy script to write, but I could not get auto mouse move to be consistent. Seems like everytime I use DllCall with mouse_event, xim4 has different results everytime.

Offline tails72

  • MVP
  • *
  • Posts: 528
    • View Profile
Re: Rapid Fire written in AHK not smooth nor consistent
« Reply #5 on: 02:23 AM - 05/16/16 »
Mine is capped at 6400

Sent from my SM-N9005 using Tapatalk


Offline Brutalimp

  • Member
  • *
  • Posts: 344
    • View Profile
Re: Rapid Fire written in AHK not smooth nor consistent
« Reply #6 on: 01:14 PM - 05/30/16 »
Does anyone know how to add a toggle to this script? Like press F10 to toggle the rapid fire on and off?

Offline W11cE

  • Moderator
  • MVP
  • *
  • Posts: 1532
    • View Profile
Re: Rapid Fire written in AHK not smooth nor consistent
« Reply #7 on: 10:53 AM - 06/11/16 »
Does anyone know how to add a toggle to this script? Like press F10 to toggle the rapid fire on and off?
You can do this using suspend. This affects all hotkeys on the script.

Offline havoxxx

  • MVP
  • *
  • Posts: 1294
    • View Profile
Re: Rapid Fire written in AHK not smooth nor consistent
« Reply #8 on: 10:07 AM - 06/15/16 »
give this a shot?

Code: [Select]
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%

~LButton::
while GetKeyState("LButton")
{
DllCall("mouse_event", uint, 1, int, 0, int, 3, uint, 0, int, 0)
Sleep, 30
DllCall("mouse_event", uint, 1, int, 0, int, 4, uint, 0, int, 0)
Sleep, 5
}
return



example on how to make a on off switch.

Code: [Select]
f12::

Pause

Suspend

return


Admin