how to use shift+key in World of Warcraft?

Ask gaming related questions (AHK v1.1 and older)
fazniro
Posts: 5
Joined: 04 Feb 2018, 10:37

how to use shift+key in World of Warcraft?

04 Feb 2018, 10:56

I currently use this code.. but i would like to use shift+4 as well..

<::Suspend, Toggle
ifWinActive World of Warcraft
{
$4::
Loop
{
if not GetKeyState("4", "P")
break
Send 4
sleep 18
}
return
}

its used for spamming keys in wow while holding down the specified key, but would just like to add a modifier to it.


best regards fazniro
User avatar
eventhorizon
Posts: 158
Joined: 27 Oct 2016, 14:22

Re: how to use shift+key in World of Warcraft?

04 Feb 2018, 15:10

Code: Select all

<::Suspend, Toggle

ifWinActive World of Warcraft ;<---??? did you mean #IfWinActive here?
{

$+4::
$4::
	Loop 
	{
		if not GetKeyState("4", "P")
			break
		Send 4 
		sleep 18
	}
	return
	}
A computer lets you make more mistakes faster than any invention in human history – with the possible exceptions of handguns and tequila.
fazniro
Posts: 5
Joined: 04 Feb 2018, 10:37

Re: how to use shift+key in World of Warcraft?

04 Feb 2018, 16:03

I'm happy someone replied! but it doesn't work what you send me...

What i currently have is a code that will spam a key as long as i hold it down.
I can do this with every single key... like 1,2,3,4, a,b,c,d etc.
but i need this spamming feature on keys used in combination with shift.

So if i for example hold down shift+1
then i have a keybind inside the game (world of warcraft) which is shift+1 and i want the code to spam it, just like it does with the single key commands.

Make sense?


The first part of the code:
<::Suspend, Toggle
ifWinActive World of Warcraft

is simply used to tell the program to spam keys when i'm inside WoW and the <::suspend, Toggle is used to turn it on/off. . I just copied this total line of code from somewhere else.

i have tried a ton of different combinations, but i simply cant figure it out. I have tried like this (and many others):

<::Suspend, Toggle
ifWinActive World of Warcraft
{
$+4::
Loop
{
if not GetKeyState("+4", "P")
break
Send +4
sleep 18
}
return
}
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: how to use shift+key in World of Warcraft?

04 Feb 2018, 17:02

You are close.

1) As alluded to in the previous reply, use #IfWinActive to control a hotkey.

2) Next, GetKeyState() works on one key at a time. You can use If not (GetKeyState("Shift","P") and GetKeyState("4","P"))
fazniro
Posts: 5
Joined: 04 Feb 2018, 10:37

Re: how to use shift+key in World of Warcraft?

04 Feb 2018, 18:16

:/
I'm total noob at AHK could you please paste the full code...

I tried this but it dont work

<::Suspend, Toggle
#ifWinActive World of Warcraft
{
$+4::
Loop
{
If not (GetKeyState("Shift","P") and GetKeyState("4","P"))
break
Send +4
sleep 18
}
return
}


and i tried this (dont work)

<::Suspend, Toggle
#ifWinActive World of Warcraft
{
$4::
Loop
{
If not (GetKeyState("Shift","P") and GetKeyState("4","P"))
break
Send 4
sleep 18
}
return
}
User avatar
eventhorizon
Posts: 158
Joined: 27 Oct 2016, 14:22

Re: how to use shift+key in World of Warcraft?

04 Feb 2018, 21:06

See if this works for you now then...

Code: Select all

#IfWinActive World of Warcraft ;turn on this code for World of Warcraft

$+1::
$+2::
$+3::
$+4::
$+5::
$+6::
$+7::
$+8::
$+9::
$+0::
AutoFireShftKeys:
	Suspend, Permit			;allow key through suspend
	afkey := A_ThisHotkey		;get the full key string
	StringRight,afkey,afkey,1		;remove the $ modifier
	stringsplit, keydat, afkey		;split hotkey into characters
	spamsleep = 100			;set up sleep delay
	
	;--------------------------------------------
	; key is being held down? do autofire on the key and modifier
	;--------------------------------------------
	while ((GetKeyState(keydat1,"p")) && (GetKeyState(keydat2,"p")))
	{	
		Send, %afkey%
		Sleep, %spamsleep%
	}
	return
	
#IfWinActive ;turn off this code outside of World of Warcraft
A computer lets you make more mistakes faster than any invention in human history – with the possible exceptions of handguns and tequila.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: Rohwedder and 91 guests