Page 1 of 1

Trouble with simple rapid fire scripts

Posted: 25 May 2022, 13:27
by Azathoth77
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.

Re: Trouble with simple rapid fire scripts

Posted: 26 May 2022, 04:54
by mikeyww

Code: Select all

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

Re: Trouble with simple rapid fire scripts

Posted: 26 May 2022, 13:38
by Azathoth77
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! ;)

Re: Trouble with simple rapid fire scripts

Posted: 26 May 2022, 20:48
by mikeyww
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

Re: Trouble with simple rapid fire scripts

Posted: 27 May 2022, 12:15
by Azathoth77
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...

Re: Trouble with simple rapid fire scripts

Posted: 27 May 2022, 13:42
by mikeyww
Hard to say. Enjoy!

Re: Trouble with simple rapid fire scripts

Posted: 27 May 2022, 14:08
by Azathoth77
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?

Re: Trouble with simple rapid fire scripts

Posted: 27 May 2022, 14:35
by mikeyww
rnd :)

Re: Trouble with simple rapid fire scripts

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

Re: Trouble with simple rapid fire scripts

Posted: 30 May 2022, 13:39
by Azathoth77
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?

Re: Trouble with simple rapid fire scripts

Posted: 30 May 2022, 16:49
by mikeyww
Try it! See what happens. You can change the subroutine names if needed.

Re: Trouble with simple rapid fire scripts

Posted: 01 Jun 2022, 03:16
by Azathoth77
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.

Re: Trouble with simple rapid fire scripts

Posted: 01 Jun 2022, 03:30
by BoBo
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:

Re: Trouble with simple rapid fire scripts

Posted: 01 Jun 2022, 05:15
by Azathoth77
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.