Trying to make a script that presses letter n repeatedly

Ask gaming related questions
scaraber
Posts: 1
Joined: 20 Jan 2024, 03:57

Trying to make a script that presses letter n repeatedly

20 Jan 2024, 04:03

Hi,
I'm trying to write a script that presses n repeatedly very quickly like 0ms delay (is this possible? Or must it be 1ms delay)
The game I'm playing only registers when you press n manually (key going up and down).
totally new to this autohotkey thing, only discovered it today! (yes i'm slow)
Any help will be greatly appreciated!!! :wave:
User avatar
mikeyww
Posts: 27322
Joined: 09 Sep 2014, 18:38

Re: Trying to make a script that presses letter n repeatedly

20 Jan 2024, 07:36

Welcome to this AutoHotkey forum!

Code: Select all

#Requires AutoHotkey v2.0

$n:: {
 Static on := False, go := () => SendEvent('n')
 SetTimer go, on ^= True
}
OuroborosGhost
Posts: 3
Joined: 20 Jan 2024, 08:09
Contact:

Re: Trying to make a script that presses letter n repeatedly

20 Jan 2024, 08:34

;how much memory you got? ;-) all those key presses gotta go somewhere. clog your buffer and ;other things to think about but

Code: Select all

#Requires AutoHotkey v2.0
Persistent
#SingleInstance Force

;  .1seconds better off around 300ms but gotta figureout what best for ;you+system inside game
SetTimer spam, 100 
spam() {
  If GetKeyState("n", "P") {
    While GetKeyState("n", "P") {
        Sendinput "n"
        }

    Return
  }
  }
[Mod edit: Added [code][/code] tags. Please use them yourself when posting code!]

;checks if n is Physically held down.
;theres better ways (i started learning a couple days ago) but this simple setup ive had the most ;success


;IMPORTANT
;if doesnt work but opening .ahk and testing keyfunction produces no errors:convert to exe and run ;as admin

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 4 guests