Simple WASD script acts weird when pressing keys simultaneously?

Ask gaming related questions (AHK v1.1 and older)
gyrote
Posts: 2
Joined: 10 Mar 2020, 19:50

Simple WASD script acts weird when pressing keys simultaneously?

10 Mar 2020, 23:55

Heya, I'm using this script here, not written by me, as a base to tweak key-press overriding behavior. https://github.com/Qiasfah/Null-Movement-Script/blob/master/Null%20Movement.ahk

The purpose of the script linked is so that when holding either A or D, the second key you press will override the first. Releasing either of the keys allows the other still-depressed one to function as normal until a second key is pressed (which overrides it). The script linked above only affects the A and D keys.

The problem I've run into is that sometimes pressing down and holding A/D at the same time will cause the script to rapidly spam alternating keys as long as its held. Tested this behavior across multiple games. I'm not sure why this is happening or what I can do to fix it.

Example of only the A and D keys held down: https://imgur.com/a/CQmaKpE Something odd about this... This example and different game I tested will normally make you stand still when both A and D are depressed, cancelling each other out basically, yet when opening the chat box during this glitch I saw it was being spammed with ad repeatedly but the character is still stuttering left and right. I'm not sure if thats just a quirk related to how the game reads inputs vs chatbox text, or if it means they were still being sequentially input just alternating extremely fast but thought I'd mention it.

If you want to replicate this behavior
- Know that it may take a couple minutes worth of attempts to trigger it.
- Dont use SendMode Input because it causes unrelated 'stuck' key issues where the game acts like the physically unreleased key is still held down.
- If you use SetKeyDelay have at least a Delay parameter of 0. Using -1 causes the 'stuck' issues from above.
- If you use SetKeyDelay with a high delay parameter, say the default of 10, that can cause you to get queued up input spam well after youve release the keys(good for testing the chatbox).

Appreciate any feedback yall can give.
gyrote
Posts: 2
Joined: 10 Mar 2020, 19:50

Re: Simple WASD script acts weird when pressing keys simultaneously?

22 Mar 2020, 18:13

Bump. Excerpt from relevant part of script.

Code: Select all

*$a::
	a_held := 1
	
	if (d_scrip){ 
		Send {Blind}{d up} ; Release the d key if it's held down
		d_scrip := 0
	}
	
	if (!a_scrip){
		Send {Blind}{a down} ; Send the a down key
		a_scrip := 1
	}
	return

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 71 guests