Continue Sending Key After Pressing Another

Ask gaming related questions (AHK v1.1 and older)
Fat
Posts: 10
Joined: 11 Nov 2017, 21:03

Continue Sending Key After Pressing Another

11 Nov 2017, 21:23

Hello again all
i have a question about something i have in my brain but cant remember. been years since i had to deal with this. ill make a hypothetical description to keep it simple for now.


while holding any key( we'll use "1") down, tap any other key( we'll use "2") and release. still holding the 1, it has stopped sending. is there a way to have the first key continue without release and repress?
testing in notepad. it would look like this to me,"1111111111111111111222222". i want it to look something like this,"11111111111111111112222221111111111111111111".

what its for:
game called Fortnite. there is an inventory "while held" button. if you are holding w(move forward) and press and release that inventory button, you have to release and press w again to continue moving forward. trying to get w to keep sending when inventory("LAlt") is released.


i know ive used a script to remedy this before but cant find it.

thank you
AF
User avatar
Barney
Posts: 55
Joined: 28 May 2014, 20:03
Location: Germany

Re: Continue Sending Key After Pressing Another

11 Nov 2017, 21:55

You can use ~2 up:: to detect when the button 2 is released.
Fat
Posts: 10
Joined: 11 Nov 2017, 21:03

Re: Continue Sending Key After Pressing Another

11 Nov 2017, 22:17

yes, that is one of the things i tried from my old bag of tricks. maybe its my system or keyboard? but im pretty sure its common for KBs to stop sending in that situation. its a ps/2 type.
does that work for you? i have no problem with the script understanding what i want it to do. the 1 just wont resume sending.

edit: maybe i could make it work if i know a command or script to have keys repeat or loop.

here is the last script i was messing with. is gives "11111111111111122222221" on notpad.. only one "1".

~2 up::
Send {1 up}
sleep 100
Send {1 down}
keywait, 1, U
Send {1 up}
return
Last edited by Fat on 11 Nov 2017, 22:20, edited 1 time in total.
User avatar
Barney
Posts: 55
Joined: 28 May 2014, 20:03
Location: Germany

Re: Continue Sending Key After Pressing Another

11 Nov 2017, 23:00

you have to use a loop to send multiple 1. In it use GetKeyState to check if 1 is still pressed down.
Fat
Posts: 10
Joined: 11 Nov 2017, 21:03

Re: Continue Sending Key After Pressing Another

12 Nov 2017, 05:32

well i got it working for one cycle, then it gets stuck in loop. now i need to find a way to have it start over when LAlt is pressed again.. but then i think ill run into the initial problem again. the w key will just sit there unless... if i could look at some examples, i can figure it out. heres what works once then sticks:

~LAlt::
KeyWait, LAlt, U

Loop
{
Sleep, 10
GetKeyState, state, w, P
if state = U
break
Send {w Down}
}
Send {w Up}

return
User avatar
Barney
Posts: 55
Joined: 28 May 2014, 20:03
Location: Germany

Re: Continue Sending Key After Pressing Another

12 Nov 2017, 07:25

example:

Code: Select all

~5 up::
Loop
{
Sleep, 500
GetKeyState, state, 4, P
if state = U
break
Send {4 }
}
return
works here
Fat
Posts: 10
Joined: 11 Nov 2017, 21:03

Re: Continue Sending Key After Pressing Another

12 Nov 2017, 12:03

i got this to work seemingly perfect BUT, when i replace the "k" with the button i actually use "LAlt", the first time it works. then second+ tries, you get flashdance caught in loop. isnt there a way to pop out of the loop if Alt is pressed again? maybe there is something in a header that can help?
i also tried to toy with rebinding "$LAlt::k" type of things.. the game maybe doesnt like Alt...

~k up::
Loop
{
GetKeyState, state, w, P
if state = U
break
Send {w down}
}
return
Fat
Posts: 10
Joined: 11 Nov 2017, 21:03

Re: Continue Sending Key After Pressing Another

12 Nov 2017, 18:08

ok got it. but when i hit the Alt key while moving forward, the function i have Ctrl bound to gets triggered. this only happens after the first press while "w" is being held. i can easily rebind this. but, it would be nice to know why this is happening. is Alt + w a shortcut for something that would cause this?
here is the "finished" script in case anyone wanted this for Fortnite.

Code: Select all

~LAlt up::
Loop
{
sleep, 50
GetKeyState, state, LAlt, P
if state = D
break
{
GetKeyState, state, w, P
if state = U
break
Send {w down}
}
}
return

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 86 guests