Can anyone improve upon this script? Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Evil-e
Posts: 262
Joined: 04 Sep 2018, 11:09

Can anyone improve upon this script?

24 Oct 2018, 07:46

When it comes to crouch and ADS, I much prefer "hold" than "toggle", but many games are hard-coded as toggle with no menu option to change it

dangreen123 posted this script over two years ago and during a search, I found it...

---------------------------------------------------------------
*a::
Send , p.....................;mapped crouch to "p" key
Return

*a up::
Send , p
Return
-----------------------------------------------------------------

It is a simple script and works in most games I have tried. Many of those games my character will do the prairie dog shuffle and stutter up and down after 4 or 5 seconds of holding "A" down. When the key is released, it is sometimes fine, but will often "reverse" the action. So I then have to "hold" the key to stand up. A little futzing with the key and it will return to normal action, until it key is held down too long and process starts over again :(

Does anyone know of an improved way of changing a hard-coded "toggle" key to make it "hold"?

Thanks :morebeard:
I have a bit of experience opening and sending commands to game console and CMD.exe... just ask :)
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Can anyone improve upon this script?

24 Oct 2018, 09:09

whats likely happening is u press and hold a and a's auto-repeat kicks in, causing multiple ps to get sent, hence the spastic crouching. u need to handle the auto-repeat:

Code: Select all

*a Up::
	aDown := false
	Send {Blind}p
return

#If !aDown
*a::
	aDown := true
	Send {Blind}p
return

#If aDown
*a::return
or using KeyWait but dont mix it with other hotkeys:

Code: Select all

*a::
	Send {Blind}p
	KeyWait a
	Send {Blind}p
Return
Evil-e
Posts: 262
Joined: 04 Sep 2018, 11:09

Re: Can anyone improve upon this script?  Topic is solved

24 Oct 2018, 15:19

DUDE!..... awesome script :clap:

You understood what was happening and addressed it perfectly. I played a game for an hour or so and never one time did it stutter or reverse action.
One thing I did notice, and by no means a deal breaker, but when this script is running, I have no access to right-click menu. Either prior to starting the game, during the game (when accessing Desktop) or after the game has been shut down. I need CTRL+ALT+DELETE to open Task Manager and shut down the script manually. It needs to be the last line of code in the AHK file and cannot duplicate it for use on both crouch and ADS. If so, it interferes with other programmed keys and they stop working.

I initially tried the keywait option and worked great, but it too would "reverse" controls at times. However, not nearly as often and never did the jitterbug bop, so a big improvement over my original script. I have combined both of these scripts on a game that toggles both crouch and ADS and
makes the game more enjoyable to play.

Many thanks, swag.... beers on me :beer:

The Beard :morebeard:
I have a bit of experience opening and sending commands to game console and CMD.exe... just ask :)

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: prototype_zero and 86 guests