Conditional Keybinding Topic is solved

Ask gaming related questions
Starker
Posts: 10
Joined: 27 Mar 2018, 18:39

Conditional Keybinding  Topic is solved

04 Aug 2020, 06:52

I need my script to include a press to toggle section (which works so far) and a condition sensitive keybinding. LButton should not be rebound (it should send LButton) when the logical state of P is up. LButton should release P (send it up) when the logical state of P is down.

When the script is run, LButton does nothing regardless of the logical state of P.

Code: Select all

3::
	KeyDown := !KeyDown
	If KeyDown
		SendInput {P down}
	Else
		SendInput {P up}
	Return
Return

If (GetKeyState(P) = 1)
	LButton::SendInput {P up}
Return
Rohwedder
Posts: 3377
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Conditional Keybinding

05 Aug 2020, 10:09

Hallo,
try:

Code: Select all

3::
KeyDown := !KeyDown
If KeyDown
	SendInput {p down}
Else
	SendInput {p up}
Return
#If GetKeyState("p")
LButton::SendInput {p up}
#If
Or perhaps:

Code: Select all

3::SendInput {p down}
#If GetKeyState("p")
LButton::SendInput {p up}
3::SendInput {p up}
#If

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 13 guests