I need help in this very simple script

Ask gaming related questions (AHK v1.1 and older)
Makadi
Posts: 6
Joined: 22 May 2016, 12:02

I need help in this very simple script

26 Apr 2017, 14:04

I have this script

Code: Select all

$LShift::
	Send, {LShift down}
	While GetKeyState("LShift", "P") {
		Sleep, 50
	}
	Send, {LShift up}
	if(A_PriorKey = "LShift"){
		Send, {c}
               
	}
return
it is simple if I pressed the Lshift up it sends {C} key if else it read which key I pressed with Lshift send that new command and cancel the send {C} key part
my problem is it does not cancel send {C} when I press Lshift+LButton
Makadi
Posts: 6
Joined: 22 May 2016, 12:02

Re: I need help in this very simple script

26 Apr 2017, 15:39

I use this code in GW2 some of my abilities are like shift+x shift+e shift+r
and I wanted to use the {shift} it self for my first ability so LShift up sends {c} which is my first ability key but if I used shift+(any thing) it cancel {c}
and this works fine except for when I press shift+LButton on my mouse it does not cancel send {c}
Makadi
Posts: 6
Joined: 22 May 2016, 12:02

Re: I need help in this very simple script

26 Apr 2017, 15:46

you are right I used your script it still do the same thing but my problem still exists I want to cancel send {c} if I pressed Lshift+LButton
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: I need help in this very simple script

27 Apr 2017, 08:37

So you want to use Shift on it's own to send C, but still allow Shift+x etc?
Not as simple as it sounds. For example, if you hold Shift, then hit X, then release X, when you finally release Shift, it needs to know that you just released X and not to count the release of shift.

So basically, if you want to allow Shift+x and Shift+e, you would need to set a variable when shift+e activated, and each time shift is released, check if the variable is set, and if so, do not send C.

Code: Select all

last_press_was_shifted := 0

~Shift up::
	if (!last_press_was_shifted){
		;Tooltip SHIFT RELEASE - SEND C
		Send C
	}
	last_press_was_shifted := 0
	return

~+e::
~+x::
	;Tooltip % A_ThisHotkey
	last_press_was_shifted := 1
	return

^Esc::
	ExitApp


Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 73 guests