Somebody knows how to make a sequence without holding? Topic is solved

Ask gaming related questions (AHK v1.1 and older)
FortniteSpanishGuy
Posts: 15
Joined: 11 Jun 2021, 12:31

Somebody knows how to make a sequence without holding?

Post by FortniteSpanishGuy » 11 Jun 2021, 13:21

for example: i want to push R release R, after that i push T release T and in the outcome i would like to send me the letter U

but if after pushing and releasing the letter R, i push and release the letter G i want that this sequence becomes canceled, so if after G, i push/release the letter T, it doesnt send me the letter U


(Pd: Im spanish but im posting in the english forums too because theres not much spanish people who knows about AHK, sorry about the translation by the way)
Last edited by BoBo on 12 Jun 2021, 23:43, edited 1 time in total.
Reason: Moved to Gaming section.
User avatar
mikeyww
Posts: 26607
Joined: 09 Sep 2014, 18:38

Re: Somebody knows how to make a sequence without holding?

Post by mikeyww » 11 Jun 2021, 14:44

Code: Select all

r Up::
on := True
SoundBeep, 1500
Return
#If on
t Up::
Send u
g Up::
on := False
SoundBeep, 1000
Return
#If
FortniteSpanishGuy
Posts: 15
Joined: 11 Jun 2021, 12:31

Re: Somebody knows how to make a sequence without holding?

Post by FortniteSpanishGuy » 11 Jun 2021, 16:22

amazing thank you very much!
but, when i press R doesnt show up... and the T doesnt show up after the r

is there a way to do it?

edit: i think i finally did it like this

Code: Select all

r::
{
Send {r}
return
}
t::
{
Send {t}
return
}
g::
{
Send {g}
return
}
r Up::
on := True
Return
#If on
t Up::
Send u
g Up::
on := False
Return
#If
[Mod edit: [code][/code] tags added.]


edit2: now i have a problem with the R & F:U command
it doesnt let me put rrrrrr when i press R only one r in the release, i think the "&" its bugged with the "If" command, is there a way to fix it?
FortniteSpanishGuy
Posts: 15
Joined: 11 Jun 2021, 12:31

Re: Somebody knows how to make a sequence without holding?

Post by FortniteSpanishGuy » 11 Jun 2021, 18:15

uhmm now i have a problem.... when i want to add

R & F::U

it bugs and doesnt let me write rrrrrrrrrrr while pressing R and only when i release puts one r

if i dont put these "R & F::U" it doesnt bug, why its happening?
User avatar
mikeyww
Posts: 26607
Joined: 09 Sep 2014, 18:38

Re: Somebody knows how to make a sequence without holding?  Topic is solved

Post by mikeyww » 11 Jun 2021, 18:43

OK. The following might be easier.

Code: Select all

~r Up::
on := True
SoundBeep, 1500
Return
#If on
~t Up::
Send u
~g Up::
on := False
SoundBeep, 1000
Return
#If
FortniteSpanishGuy
Posts: 15
Joined: 11 Jun 2021, 12:31

Re: Somebody knows how to make a sequence without holding?

Post by FortniteSpanishGuy » 11 Jun 2021, 19:23

i dont know what this symbol ~ means but you are a god, thank you very much :D you solved my bug, scripting and learning is so interesting im beginning in this :D :D :D
User avatar
mikeyww
Posts: 26607
Joined: 09 Sep 2014, 18:38

Re: Somebody knows how to make a sequence without holding?

Post by mikeyww » 11 Jun 2021, 19:41

Good to hear. The tilde simply avoids blocking the native function. To the user, this has the effect of "sending the key through".
FortniteSpanishGuy
Posts: 15
Joined: 11 Jun 2021, 12:31

Re: Somebody knows how to make a sequence without holding?

Post by FortniteSpanishGuy » 12 Jun 2021, 17:28

uhmmmmm now im testing 2 times IF command in the same script, but doesnt let me do it digitally only physycal when i press g (i made this for auto start from 0 with F or R)
should i make 2 ahk files for 2 differents IF?

Code: Select all

f::
{
Send {g}
return
}

~r Up::
on := True
Return
#If on
t Up::
Send u

~g Up::
on := False
Return
#If

r::
{
Send {g}
return
}

~f Up::
on := True
Return
#If on
t Up::
Send j

~g Up::
on := False
Return
#If
[Mod edit: [code][/code] tags added.]
Last edited by gregster on 12 Jun 2021, 17:30, edited 1 time in total.
Reason: Please use [code] tags. Thank you!
User avatar
mikeyww
Posts: 26607
Joined: 09 Sep 2014, 18:38

Re: Somebody knows how to make a sequence without holding?

Post by mikeyww » 12 Jun 2021, 17:44

One possibility is below.

Code: Select all

r::
f::Send g

~r Up::
on := True
SoundBeep, 1500
Return
#If on
t Up::
Send u
~g Up::
on := False
SoundBeep, 1200
Return
#If

~f Up::
on2 := True
SoundBeep, 1000
Return
#If on2
t Up::
Send j
~g Up::
on2 := False
SoundBeep, 700
Return
#If
Alternatively:

Code: Select all

$t::Send % A_PriorKey = "r" ? "u" : A_PriorKey = "f" ? "j" : "t"
FortniteSpanishGuy
Posts: 15
Joined: 11 Jun 2021, 12:31

Re: Somebody knows how to make a sequence without holding?

Post by FortniteSpanishGuy » 12 Jun 2021, 20:30

Code: Select all

$t::Send % A_PriorKey = "r" ? "u" : A_PriorKey = "f" ? "j" : "t"
This works but if i want to change the key for example double R to make U doesnt display the r, so for me this is weird but interesting

Code: Select all

r::
f::Send g

~r Up::
on := True
SoundBeep, 1500
Return
#If on
t Up::
Send u
~g Up::
on := False
SoundBeep, 1200
Return
#If

~f Up::
on2 := True
SoundBeep, 1000
Return
#If on2
t Up::
Send j
~g Up::
on2 := False
SoundBeep, 700
Return
#If
The "on" with numbers was awesome! i didnt know that "on" can have numbers, but i still have the same problem, when i change R to F it doesnt add the G physycally to cancel the sequence, so when i write: "f r u" since U was detected if i try to get the J it just doesnt display
(and if i want to make R+R instead R+T i just get the same problem, when i change to F it doesnt stop the sequence)

But dont worry i fixed the problem making 2 independent files, and it works awesome, you helped me a lot thank you so much! :D :D
User avatar
mikeyww
Posts: 26607
Joined: 09 Sep 2014, 18:38

Re: Somebody knows how to make a sequence without holding?

Post by mikeyww » 12 Jun 2021, 20:55

OK. I was only guessing, because you did not describe the intended effect. In any case, "on" is just a variable name, so you can call it just about anything, "jimbo_39x" or whatever. Variables are global by default, so when you need to track separate things, you need different variable names. To "send the key through", precede the hotkey with tilde; its native function will otherwise be blocked. I don't think you need two scripts, but if it works, it works. Keep in mind that two processes that use a keyboard hook can conflict with each other. Best of luck.
FortniteSpanishGuy
Posts: 15
Joined: 11 Jun 2021, 12:31

Re: Somebody knows how to make a sequence without holding?

Post by FortniteSpanishGuy » 12 Jun 2021, 21:41

mikeyww wrote:
12 Jun 2021, 20:55
OK. I was only guessing, because you did not describe the intended effect. In any case, "on" is just a variable name, so you can call it just about anything, "jimbo_39x" or whatever. Variables are global by default, so when you need to track separate things, you need different variable names. To "send the key through", precede the hotkey with tilde; its native function will otherwise be blocked. I don't think you need two scripts, but if it works, it works. Keep in mind that two processes that use a keyboard hook can conflict with each other. Best of luck.
i wanted a custom macro made by myself for a game called fortnite, you know it has a lot of buttons so i made it to reduce some buttons for be less stressfull
i finished my script (i think), and they dont conflict while im playing, thats a good signal
thank you mikeyww! :)
Post Reply

Return to “Gaming Help (v1)”