i need some help modifying a script

Ask gaming related questions (AHK v1.1 and older)
iekgaa
Posts: 2
Joined: 09 Feb 2018, 07:05

i need some help modifying a script

09 Feb 2018, 07:11

hello everybody,

i need a script that presses Z every 0,25 seconds for as long as i hold it,
after looking around on the forums this is the only thing i could find.

Code: Select all

$Z::
  While GetKeyState("Z","P")
    Send, {Z}
Return
the thing is, this spams the Z key way to fast. can anybody change the script so it does what i need it to do,
thanks for the help in advance.

kind regards,
iekgaa
User avatar
eventhorizon
Posts: 158
Joined: 27 Oct 2016, 14:22

Re: i need some help modifying a script

09 Feb 2018, 08:18

Code: Select all

$Z::
	While GetKeyState("Z","P")
 	 {	Send, Z
  		sleep 250
 	 }
	Return
A computer lets you make more mistakes faster than any invention in human history – with the possible exceptions of handguns and tequila.
iekgaa
Posts: 2
Joined: 09 Feb 2018, 07:05

Re: i need some help modifying a script

09 Feb 2018, 10:47

Very nice :D
so the sleep 250 stands for 250ms,
also if i want to use this script for more keys is it best to just copy paste or is there a way to make it cleaner,
the keys i want to use are:
qwert
asdf
zxcv

kind regards,
iekgaa
User avatar
eventhorizon
Posts: 158
Joined: 27 Oct 2016, 14:22

Re: i need some help modifying a script

10 Feb 2018, 01:41

Lots of different ways it could be done. depending on how you want the keys sent, in what order, how fast to send them, how you want them grouped, All scripts are a work in progress. None is ever really finished because there are always ways to improve it or adapt it to new situations. This is where the AutoHotkey Help file and this forum board come in so handy. You can learn a lot from the people here. But, in the end it's all about what YOU do. Coding is not a spectator sport. It's an active, ongoing, education. To really learn you have to do scripting, not just see it done.
A computer lets you make more mistakes faster than any invention in human history – with the possible exceptions of handguns and tequila.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 69 guests