World of Warcraft hold until release

Ask gaming related questions (AHK v1.1 and older)
Jacob
Posts: 2
Joined: 07 May 2016, 23:02

World of Warcraft hold until release

07 May 2016, 23:07

Hi there guys. I'm new to AHK and I tried to make a script by myself but I just can't comprehend it.
I am looking for script for pressing a button down so it spams until i release it.
I want to make it for binds like 1,2,3,4,5,q,e,r (each seperate).
I would also like to turn it on and off with one button like F5 for example.


Thanks for your time and help.

Cheers,
Jacob.
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: World of Warcraft hold until release

08 May 2016, 01:15

Code: Select all

#NoEnv
#UseHook
SendMode, Input

1::
2::
3::
4::
5::
q::
e::
r::Spaminator(A_ThisHotkey)
F5::Suspend

Spaminator(K)
{
    While GetKeyState(K,"P")
    {
	    Send % K
	    Sleep 10
	}
}
User avatar
WAZAAAAA
Posts: 88
Joined: 13 Jan 2015, 19:48

Re: World of Warcraft hold until release

08 May 2016, 10:03

You should probably try this tool first to see what kinds of Send types are supported or blocked by your application and act accordingly:
https://autohotkey.com/board/topic/9565 ... -tool-v41/
For example, some games ignore SendInput and only accept SendEvent.
YOU'RE NOT ALEXANDER
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: World of Warcraft hold until release

09 May 2016, 04:04

These keys are bound in game so you will want to use ~ prefix.

Code: Select all

#NoEnv
SendMode, Input

~1::
~2::
~3::
~4::
~5::
~q::
~e::
~r::Spaminator(SubStr(A_ThisHotkey, 0))   
F5::Suspend

Spaminator(K)
{
    While GetKeyState(K,"P")
    {
	    Send, {%K% Down}
	    Sleep 20
		Send, {%K% Up}
	}
}
I added down sleep up for each spammed keystroke even though you probably don't need it.
Jacob
Posts: 2
Joined: 07 May 2016, 23:02

Re: World of Warcraft hold until release

23 May 2016, 15:53

Thank you for your help ;) works amazing!!!!!

Can you explain what sleep means in this? and #NoEnv? and if I want to put keybind "shift+1" or "alt+1" should I add like that or it looks different?
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: World of Warcraft hold until release

26 May 2016, 14:32

#NoEnv
Avoids checking empty variables to see if they are environment variables (recommended for all new scripts).

It not really needed for this script.

Sleep
Waits the specified amount of time before continuing.

To spam shift1 or alt1 it could be done like this:

Code: Select all

#NoEnv
SendMode, Input


~!1::    ; Alt 1 hotkey
~+1::    ; Shift 1 hotkey
~1::
~2::
~3::
~4::
~5::
~q::
~e::
~r::Spaminator(SubStr(A_ThisHotkey, 0))   
F5::Suspend

Spaminator(K)
{
    While GetKeyState(K,"P")
    {
	    Send, {Blind}{%K% Down}
	    Sleep 20
		Send, {Blind}{%K% Up}
	}
}
blind-mode Send
When {Blind} is the first item in the string, the program avoids releasing Alt/Control/Shift/Win if they started out in the down position.

HTH

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 42 guests