Autofire with Custom Combination without activating single key

Ask gaming related questions (AHK v1.1 and older)
dereker
Posts: 5
Joined: 15 Nov 2016, 02:27

Autofire with Custom Combination without activating single key

22 Nov 2016, 00:42

Hello, this is the script I currently use:
#MaxHotkeysPerInterval 10000

~$1::
sleep 300
Loop
{
GetKeyState, var, 1, P
If var = U
Break
Send {1}
}

~$2::
sleep 300
Loop
{
GetKeyState, var, 2, P
If var = U
Break
Send {2}
}

~$3::
sleep 300
Loop
{
GetKeyState, var, 3, P
If var = U
Break
Send {3}
}

~$4::
sleep 300
Loop
{
GetKeyState, var, 4, P
If var = U
Break
Send {4}
}

~$5::
sleep 300
Loop
{
GetKeyState, var, 5, P
If var = U
Break
Send {5}
}

Ctrl & c::
Loop
{
if not GetKeyState("c", "P")
break
Send, {Ctrl Down}{c down}
Send, {Ctrl Up}{c up}
}

Ctrl & v::
Loop
{
if not GetKeyState("v", "P")
break
Send, {Ctrl Down}{v down}
Send, {Ctrl Up}{v up}
}

Ctrl & b::
Loop
{
if not GetKeyState("b", "P")
break
Send, {Ctrl Down}{b down}
Send, {Ctrl Up}{b up}
}
It allows me to autofire by holding down the keyboard buttons 1, 2, 3, 4, 5, CTRL+C, CTRL+V, CTRL+B.

Now here's the problem...

Before 1:: 2:: 3:: 4:: 5:: I am able to put ~$ which in turn avoids the autofire from starting when I am pressing, for example, ALT + 1. In other words, thanks to ~$ I can autofire when I'm pressing ONLY 1 and it won't interfere when I am pressing 1 and any other modifier such as ALT, CTRL, SHIFT at the same time, it works perfectly.

I cannot do this with CTRL+C, CTRL+V, CTRL+B; when I try to put ~$ before them like this ~$Ctrl & c:: it gives me an error, so when I hold down CTRL + C to autofire exclusively the action keybound on CTRL + C it also starts autofiring C. I don't want C to autofire when I'm holding CTRL + C. How do I do this? Thanks in advance!
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: Autofire with Custom Combination without activating single key

22 Nov 2016, 05:53

It may be due to your syntax - eg Ctrl & C:: rather than the more common ^C::. The & syntax is not really intended for Key+Modifier (eg CTRL & C), it is intended for Key+Key (eg A & B)

The following does not throw an error: ~$^c::
dereker
Posts: 5
Joined: 15 Nov 2016, 02:27

Re: Autofire with Custom Combination without activating single key

22 Nov 2016, 12:05

You are right, this way there is no error but the problem is not solved. When I autofire CTRL + C, C alone starts autofiring aswell. So I guess the ~$ only works in case of single key to avoid autofire when pressing modifier, not other way around. I really need other way around too :(
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: Autofire with Custom Combination without activating single key

24 Nov 2016, 09:29

~$^c::
I think that the ~ is maybe why C is repeating?
~ Means "Do not block", so maybe C is not being "Sent" by AHK, C is being "Sent" by your keyboard, and AHK is not blocking it.

Try removing the ~
dereker
Posts: 5
Joined: 15 Nov 2016, 02:27

Re: Autofire with Custom Combination without activating single key

24 Nov 2016, 14:37

I tried, still sends C and CTRL+C. I don't get it... :(

Maybe the problem is in how
Send {Ctrl Down}{c Down}
Send {c Up}{Ctrl Up}
works, is there another way to send CTRL+C to try whether that fixes the problem?

EDIT: I fixed it!!! Yes, the problem was exactly that. I replaced that part with
Send ^{c}
and now only CTRL+C gets sent!

Thanks evilC for the help.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 37 guests