Trouble with simple rapid fire scripts

Ask gaming related questions (AHK v1.1 and older)
Azathoth77
Posts: 8
Joined: 25 May 2022, 13:06

Trouble with simple rapid fire scripts

Post by Azathoth77 » 25 May 2022, 13:27

Hi, I got a problem with making a functional rapid fire script to use in indie games that require fast-multiple keypresses.

I already tried to user the built-in macro system from my keyboard (Sharkoon SGK4) and it does work, but whenever the macro stops (when I lift the assigned button) the entire keyboard imput gets reset, so if my character is firing while moving, leaving the button makes him stop, even if I am still holding the movement arrow key. This is obviously unacceptable in games that require fast and tight control.

Now, I tried to use several scripts I found lying around in the forums, but I was not successful.
One of them did work (unfortunately it seems I lost it) but pressing any other key during the action caused the rapid fire to stop.

Can you guys paste me a simple script?
Basically I want that whenever the numpad 9 is kept pressed, the numpad 6 gets mashed every 80 milliseconds, and the mashing stops whenever numpad 9 is lifted.
It also must be "proof" to other key presses, working alongside them without interfering and not stopping when other keys are touched.
Last edited by gregster on 25 May 2022, 13:31, edited 1 time in total.
Reason: Topic moved from 'Scripts and Functions > Gaming'.

User avatar
mikeyww
Posts: 26604
Joined: 09 Sep 2014, 18:38

Re: Trouble with simple rapid fire scripts

Post by mikeyww » 26 May 2022, 04:54

Code: Select all

Numpad9::
SetTimer, Mash, 80
KeyWait, Numpad9
SetTimer, Mash, Off
Return
Mash:
Send {Numpad6}
Return

Azathoth77
Posts: 8
Joined: 25 May 2022, 13:06

Re: Trouble with simple rapid fire scripts

Post by Azathoth77 » 26 May 2022, 13:38

mikeyww wrote:
26 May 2022, 04:54

Code: Select all

Numpad9::
SetTimer, Mash, 80
KeyWait, Numpad9
SetTimer, Mash, Off
Return
Mash:
Send {Numpad6}
Return
Thanks, this seems to be a good step in the right direction.

I tested in Microsoft Word and it does exactly what I want, but whenever I load a game i get very erratic results, some games do not register keypresses at all, other seems to register them but with great delay and inferior firerate when compared to normal button mashing.

I tried to edit the time, up to 500 ms, but I still get erratic results.
I think that all those games have very different timing "tolerances" and this causes the issue.

I also think that the solution would be a perfect emulation of natural button mashing, including "natural" timing between "press" and "release" of the buttons.
Other than this I am really at loss and I don't know what to do.

Sometimes I get my young nephew to mash the fire button for me in these games and it always works.
He has fun and my old bones thank me, but unfortunately I cannot always keep him around playing old school videogames, he's got school and responsibilities! :D
Basically I need a script to replace him. I won't tell him, I promise! ;)

User avatar
mikeyww
Posts: 26604
Joined: 09 Sep 2014, 18:38

Re: Trouble with simple rapid fire scripts

Post by mikeyww » 26 May 2022, 20:48

Tips for games: viewtopic.php?f=7&t=11084

Code: Select all

If !A_IsAdmin && !(DllCall("GetCommandLine", "str") ~= " /restart(?!\S)") {
 Try Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
 ExitApp
}
Numpad9::
SetTimer, Mash, 80
KeyWait, Numpad9
SetTimer, Mash, Off
Return
Mash:
Random, rnd, 20, 50
SetKeyDelay,, rnd
Send {Numpad6}
Return

Azathoth77
Posts: 8
Joined: 25 May 2022, 13:06

Re: Trouble with simple rapid fire scripts

Post by Azathoth77 » 27 May 2022, 12:15

mikeyww wrote:
26 May 2022, 20:48
Tips for games: viewtopic.php?f=7&t=11084

Code: Select all

If !A_IsAdmin && !(DllCall("GetCommandLine", "str") ~= " /restart(?!\S)") {
 Try Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
 ExitApp
}
Numpad9::
SetTimer, Mash, 80
KeyWait, Numpad9
SetTimer, Mash, Off
Return
Mash:
Random, rnd, 20, 50
SetKeyDelay,, rnd
Send {Numpad6}
Return
This works on a single game but there are still others that simply do not register any keypresses...stuff like Huntdown and the Mame emulator.

I guess it's stil la timing related thing...

User avatar
mikeyww
Posts: 26604
Joined: 09 Sep 2014, 18:38

Re: Trouble with simple rapid fire scripts

Post by mikeyww » 27 May 2022, 13:42

Hard to say. Enjoy!

Azathoth77
Posts: 8
Joined: 25 May 2022, 13:06

Re: Trouble with simple rapid fire scripts

Post by Azathoth77 » 27 May 2022, 14:08

mikeyww wrote:
27 May 2022, 13:42
Hard to say. Enjoy!
Thanks, you were very kind and helpful!

I'd like to experiment with the last script you posted, which are the timing variables?

User avatar
mikeyww
Posts: 26604
Joined: 09 Sep 2014, 18:38

Re: Trouble with simple rapid fire scripts

Post by mikeyww » 27 May 2022, 14:35

rnd :)

Azathoth77
Posts: 8
Joined: 25 May 2022, 13:06

Re: Trouble with simple rapid fire scripts

Post by Azathoth77 » 27 May 2022, 14:37

mikeyww wrote:
27 May 2022, 14:35
rnd :)
Thanks ,will experiment in the next days! :bravo:

Azathoth77
Posts: 8
Joined: 25 May 2022, 13:06

Re: Trouble with simple rapid fire scripts

Post by Azathoth77 » 30 May 2022, 13:39

Is there any other freeware software that might allow the simple creation of this rapid fire button?
This "Huntdown" game simply ignores aut-hotkey.

Also, back to autohotkey, can I replicate multiple times the text above in the same script so I can create multiple auto-fire buttons?

User avatar
mikeyww
Posts: 26604
Joined: 09 Sep 2014, 18:38

Re: Trouble with simple rapid fire scripts

Post by mikeyww » 30 May 2022, 16:49

Try it! See what happens. You can change the subroutine names if needed.

Azathoth77
Posts: 8
Joined: 25 May 2022, 13:06

Re: Trouble with simple rapid fire scripts

Post by Azathoth77 » 01 Jun 2022, 03:16

mikeyww wrote:
30 May 2022, 16:49
Try it! See what happens. You can change the subroutine names if needed.
I made several experiments and also tried more scripts but none of them worked.

Could you post me another couple of scripts that do the same thing, maybe using different methods? Maybe some will be able to fool this game.

BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Trouble with simple rapid fire scripts

Post by BoBo » 01 Jun 2022, 03:30

Could you post me another couple of scripts...
Hint: Are you aware that in real life, there's nothing like an "eternal lifetime" or a lifetime-reset-button? What's your own effort in this "game", besides "ordering" scripts?? :wtf:

Azathoth77
Posts: 8
Joined: 25 May 2022, 13:06

Re: Trouble with simple rapid fire scripts

Post by Azathoth77 » 01 Jun 2022, 05:15

BoBo wrote:
01 Jun 2022, 03:30
Could you post me another couple of scripts...
Hint: Are you aware that in real life, there's nothing like an "eternal lifetime" or a lifetime-reset-button? What's your own effort in this "game", besides "ordering" scripts?? :wtf:
Dude, I've been fiddling with script and timing an entire afternoon, if anyone got a pre-made script he can paste it here in 2 secs, if not, peace.

Post Reply

Return to “Gaming Help (v1)”