Toggle into a hold.

Ask gaming related questions (AHK v1.1 and older)
gspotter10
Posts: 1
Joined: 24 Feb 2018, 17:40

Toggle into a hold.

24 Feb 2018, 18:55

Trying to change the toggle sprint key (LSHIFT) from a toggle into a hold button in Fallout 4.

This is what I have so far but it is not working in game at all. After leaving game my LShift does not work at all until after reboot.

Any help would be appreciated…



lshift_held := 0
$*LShift::
if (lshift_held)
return ; Filter repeats
lshift_held := 1
Send {Blind}{LShift}
return

$*LShift up::
lshift_held := 0
Send {Blind}{LShift}
return
User avatar
Nwb
Posts: 444
Joined: 29 Nov 2016, 08:56

Re: Toggle into a hold.

25 Feb 2018, 02:21

Okay if I understood you correctly, you want shift to hold when you click it once, and stop holding when you click it again? I didn't understand why you have the first return in:

Code: Select all

lshift_held := 0
$*LShift::
if (lshift_held)
return; Filter repeats
lshift_held := 1
Send {Blind}{LShift}
return
Was that a mistake?

Anyways:-

Code: Select all

Toggle := 0
$*LShift::
Toggle := !Toggle
if Toggle
    Send {Lshift down}
Else
    Send {Lshift up}
return

esc:: ExitApp ; presa esc to stop script
I am your average ahk newbie. Just.. a tat more cute. ;)
Noesis
Posts: 301
Joined: 26 Apr 2014, 07:57

Re: Toggle into a hold.

26 Feb 2018, 01:32

A couple of things to test, try without the blind statements, and also use a different hotkey (or alter the games key bind). I've had similar experiences in other games, where when the key being sent, and also the hotkey being used are the same key, it doesn't work (but will in normal apps). Changing one of them to something else like RShift (instead of LShift) usually fixes it. Point being sometimes games can see through ahk's attempts to block a key, if that same key is also used for some action within the game.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 50 guests