Page 1 of 1

Running won't stop in a game

Posted: 28 May 2023, 17:03
by WildWilbur
Hi guys,

I'm a old fart and just can't stand playing games with WASD. So I'm screwed if a game forces me to because of lack of changing keys ingame (my newest game: Jedi Survivor).

So I read about AHK and that I could very easily switch WASD with the arrow key. And I figured out this little scrip should to the trick:

Code: Select all

w::up
a::left
s::down
d::right

up::w
left::a
down::s
right::d

F12::ExitApp
And it worked indeed. But after a few minutes when I'm running with my char I'm on "autorun": my char continues to move in the direction of the last key i pushed, f.e. I'm strafing to the right and the char continues to strafe further even I released the key. And he moves further indefinitely. I thought it had somewhat to do with a "overflow" or something because I'm holding a key for too long and threw

#MaxHotkeysPerInterval 9999

as first line into the scrip but that didn't make a difference.

The working walkaround ingame is to release the key and push it again, release again and push the opposite button.

Any ideas what the problem could be or any tips to the (admittingly lousy) scrip of mine? Or ain't AHK the problem but the old brain in front of the keyboard?

Cheers,
WW


[Mod action: Moved topic to ”Gaming”]

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

Re: Running won't stop in a game

Posted: 29 May 2023, 03:10
by Rohwedder
Hallo,
try:

Code: Select all

#InstallKeybdHook
#MaxHotkeysPerInterval 9999 
SetTimer, Release, 100
up::w
left::a
down::s
right::d
Release:
Loop, Parse,% "wasd"
	SendInput,% (GetKeyState(A_LoopField) And 
	!GetKeyState(A_LoopField,"P"))?"{Blind}{" A_LoopField " Up}":""
Return

Re: Running won't stop in a game

Posted: 29 May 2023, 03:28
by WildWilbur
Thank you! I have no idea what that will do but will give it a try! :)

Re: Running won't stop in a game

Posted: 29 May 2023, 05:50
by boiler
This was posted in the v2 section. I’ll move it if you’re actually using v1.

Re: Running won't stop in a game

Posted: 29 May 2023, 13:52
by WildWilbur
Ok, I tried and it worked in general. But it stutters when I change keys (from forward to strafe f.e.). It seem to have a litte delay when switching keys and I can't use two keys simultaneously (running forward and strafe the same time)... :(

Re: Running won't stop in a game

Posted: 29 May 2023, 14:01
by boiler
Moved from the v2 section. Please post in the correct forum (for v1 and for gaming) going forward.

Re: Running won't stop in a game

Posted: 29 May 2023, 14:50
by WildWilbur
Ah, ok, thanks. It is indeed v1 - should I switch to AHK v2 instead?

Re: Running won't stop in a game

Posted: 29 May 2023, 15:46
by boiler
In general, v2 is recommended for new scripts, so I would say switch. Among other things, it eliminates the most common source of confusion in v1 -- the dual syntax of expressions and command syntax. v2 uses expressions only.

Re: Running won't stop in a game

Posted: 31 May 2023, 17:09
by WildWilbur
Switched to v2 but got the same problem. Anyone get any ideas maybe?