Action On Down, Action On Hold, Action On Release

Ask gaming related questions (AHK v1.1 and older)
Starker
Posts: 22
Joined: 27 Mar 2018, 18:39

Action On Down, Action On Hold, Action On Release

06 Apr 2024, 15:13

This is a work in progress, but it's not working as expected so I could use some advice. The pseudo code should be enough to explain what I need. Let me know if I need to clarify, thanks.

Pseudo Code:
Send "L" once if XButton1 is pressed
Hold down "O" if "XButton1" is held down
Send "L" 3 times if "XButton1" is released

Code: Select all

xbutton1::
	send {l}
	while getKeystate(xButton1) = 1 {
		send {o}
	}
	if getKeystate(xButton1) = 0
		send {l 3}
return
Current Output:
image.png
image.png (16.5 KiB) Viewed 64 times
Starker
Posts: 22
Joined: 27 Mar 2018, 18:39

Re: Action On Down, Action On Hold, Action On Release

06 Apr 2024, 15:55

Well, well, I forgot about keyWait. It's sending the right keys now. The game, Armored Core 2 on PCSX2 is not picking up anything except L being pressed and is ignoring the held O.

Code: Select all

xbutton1::
	send {l}
	send {o down}
	keyWait xButton1
	send {o up}
	send {l 3}
return
Output on XButton1 down:
image.png
image.png (20.64 KiB) Viewed 58 times
Output on XButton1 up:
image.png
image.png (35.07 KiB) Viewed 58 times
gregster
Posts: 9036
Joined: 30 Sep 2013, 06:48

Re: Action On Down, Action On Hold, Action On Release

06 Apr 2024, 20:14

Moved topic from AHk v2 help since this is v1 code. Please use the appropriate forum for your AHK version, going forward. Thank you.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 49 guests