Send {%key%} Cancels Left-Mouse Hold

Ask gaming related questions (AHK v1.1 and older)
Doom Guy
Posts: 4
Joined: 11 Jan 2022, 23:35

Send {%key%} Cancels Left-Mouse Hold

11 Jan 2022, 23:50

I'm making a Macro for Diablo 3, in which I want it to automatically use abilities on-cooldown. This works, but when I hold shift and left mouse click (Force Stand Still and Attack, respectively), my input gets cancelled/overshadowed any time 'Send {%key%}' is used, and I have to let go of shift-left-click and press it again. This does not happen when I push the keys myself, so I know for sure that this is NOT an in-game mechanic with the abilities I am auto-casting.

Anyone know what's causing this? I assume its something to do with SendMode or maybe Thread interrupts, but I'm new to AHK and am not sure how to best fix it. I've attached my script below.

Code: Select all



;DIABLO III AUTO CAST FOR STRAFE DH


;- - - Setup - - -

#SingleInstance Force
#NoEnv
#Warn

SendMode Input
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode,3

keyList := []
keyList.insert(["Numpad1",6000,0])  ;object = [key, interval(ms), nextInterval(ignore)]
keyList.insert(["Numpad2",5000,0])
keyList.insert(["Numpad3",20000,0])
keyList.insert(["Numpad4",27000,0])

toggle := false

WinActivate,Diablo III

return


Numpad9::
ifWinNotActive,Diablo III
	return
toggle := !toggle
if (toggle) {
	Send {RButton down}
	SetTimer,Auto,10
} else {
	Send {RButton up}
	SetTimer,Auto,Off
}
return


Auto:
ifWinNotActive,Diablo III
	return
loop % keyList.MaxIndex() {
	if (a_tickcount > keyList[a_index][3]) {
		keyList[a_index][3] := a_tickcount + keyList[a_index][2] - 10
		key := keyList[a_index][1]
		Send {%key%}
	}
}
return


Esc::
toggle := false
Send {RButton up}
SetTimer,Auto,Off
ExitApp
return
User avatar
mikeyww
Posts: 28872
Joined: 09 Sep 2014, 18:38

Re: Send {%key%} Cancels Left-Mouse Hold

12 Jan 2022, 01:29

If you are typing while AHK is sending keys, the two activities can conflict with each other. If you want AHK to send keys, then give it room!
Doom Guy
Posts: 4
Joined: 11 Jan 2022, 23:35

Re: Send {%key%} Cancels Left-Mouse Hold

12 Jan 2022, 04:18

mikeyww wrote:
12 Jan 2022, 01:29
If you are typing while AHK is sending keys, the two activities can conflict with each other. If you want AHK to send keys, then give it room!
Well, AHK is sending keys fine, but it is interrupting my inputs. I just want to be able to hold down the shift key and/or mouse button while AHK is sending keys... I don't see any reason why this wouldn't be possible
User avatar
mikeyww
Posts: 28872
Joined: 09 Sep 2014, 18:38

Re: Send {%key%} Cancels Left-Mouse Hold

12 Jan 2022, 07:37

You can simulate the effect by having two people type different things on your keyboard at the same time. It might work, or it might not.
Doom Guy
Posts: 4
Joined: 11 Jan 2022, 23:35

Re: Send {%key%} Cancels Left-Mouse Hold

12 Jan 2022, 15:50

mikeyww wrote:
12 Jan 2022, 07:37
You can simulate the effect by having two people type different things on your keyboard at the same time. It might work, or it might not.
As I mentioned in my initial post, this is only an issue when AHK sends keypresses. If I mimic the keypresses myself, it works as expected.
Doom Guy
Posts: 4
Joined: 11 Jan 2022, 23:35

Re: Send {%key%} Cancels Left-Mouse Hold

12 Jan 2022, 16:00

Surely there is some kind of work around, if not a straightforward solution :)

I tried checking the state of the mouse and sending it alongside any other Send {keys} if it is currently being held down, but I couldn't make this work with my limited knowledge of AHK.

If what I'm asking for is truly not possible for whatever reason, what other programs can I use to accomplish the simple task of sending a keypress without interrupting my own input?
User avatar
mikeyww
Posts: 28872
Joined: 09 Sep 2014, 18:38

Re: Send {%key%} Cancels Left-Mouse Hold

12 Jan 2022, 20:29

Some windows will respond to ControlSend, which can be used when a responsive target window is inactive. You can always write a one-line script to see whether your target responds to that.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: kerzorath and 21 guests