Sending Hotkeys to OBS to Trigger Animations

Ask gaming related questions (AHK v1.1 and older)
lowkeynerd
Posts: 2
Joined: 20 Jun 2021, 21:12

Sending Hotkeys to OBS to Trigger Animations

20 Jun 2021, 21:22

Hello!

I am attempting to send key presses directly to OBS streaming application to trigger a run animation for a .gif character. The character sits between idle and run. I want the character to run whenever I press a, s, w, or d and stay idle if I have none of those buttons pressed.

In OBS: the idle animation shows when 1 is pressed, the idle animation is hidden when 2 is pressed, the run animation shows when 3 is pressed, the run animation hides when 4 is pressed.

Thus, we get something like this:
------------

Code: Select all

~a:: ;by pressing a, s, w, or d the character moves and we send a 2 and 3 to hide idle and show run
~s::
~w::
~d::
ControlSend,, {2}{3}, ahk_class Qt5152QWindowIcon ;this is OBS's window
return

~a up:: ;by letting go of a, s, w, or d the character idles - we send a 1 and 4 to show idle and hide run
~s up::
~w up::
~d up::
ControlSend,, {1}{4}, ahk_class Qt5152QWindowIcon ;this is OBS's window
return
[Mod edit: [code][/code] tags added.]
-------------

The issue is that if I have multiple keys pressed and the character is running and then I let go of one key but hold the others, the character stops. E.g. I press and hold a and s but then let go of s. The character stops. They should keep running because a is still held.

How do I keep them running in this scenario?
lowkeynerd
Posts: 2
Joined: 20 Jun 2021, 21:12

Re: Sending Hotkeys to OBS to Trigger Animations

20 Jun 2021, 22:18

Even something like this still causes it to stop once one of the keys is raised while the others are pressed:

Code: Select all

~a up:: controlSend,,{1}{4},ahk_class Qt5152QWindowIcon
~w up:: controlSend,,{1}{4},ahk_class Qt5152QWindowIcon
~s up:: controlSend,,{1}{4},ahk_class Qt5152QWindowIcon
~d up:: controlSend,,{1}{4},ahk_class Qt5152QWindowIcon

#if GetKeyState("a", "p")
{
	~a:: controlSend,,{2}{3},ahk_class Qt5152QWindowIcon
}

#if GetKeyState("w", "p")
{
	~w:: controlSend,,{2}{3},ahk_class Qt5152QWindowIcon
}

#if GetKeyState("s", "p")
{
	~s:: controlSend,,{2}{3},ahk_class Qt5152QWindowIcon
}

#if GetKeyState("d", "p")
{
	~d:: controlSend,,{2}{3},ahk_class Qt5152QWindowIcon
}

return
[Mod edit: [code][/code] tags added.]

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 49 guests