This simple script breaks Cemu/Call of the Wild

Ask gaming related questions (AHK v1.1 and older)
Quadnick
Posts: 29
Joined: 10 Mar 2021, 20:14

This simple script breaks Cemu/Call of the Wild

Post by Quadnick » 17 Jan 2022, 14:25

I just want lctrl to toggle rctrl, which is my move forward key, and v to toggle a, which is set to the sprint key. However, pressing v seemingly does nothing, and pressing lctrl causes some weirdness. After pressing lctrl, the only inputs I can use in-game are rctrl, to move forward, and my mouse, to move the camera. None of my other keys work. That is, unless I press rctrl and my move backwards key (n) really fast, then n is held down indefinitely, until I press rctrl again. Idek. Here's the script:

Code: Select all

#Persistent

#IfWinActive, AHK_exe Cemu.exe

~*lctrl::
GetKeyState, state, rctrl
if state = U
Send {rctrl Down}
else
Send {rctrl Up}
return

~*v::
GetKeyState, state, a
if state = U
Send {a Down}
else
Send {a Up}
return
I see others talking about using Autohotkey with Cemu, no problem. But I am having a hard time with it. Full disclosure: I'm not the best when it comes to scripting. I grabbed this here script from these forums years ago, and have used it in many games. Just not this one for some reason. I would really appreciate some help.

Rohwedder
Posts: 7610
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: This simple script breaks Cemu/Call of the Wild

Post by Rohwedder » 18 Jan 2022, 09:01

Hallo,
do you really know what the tilde ~ e.g. in ~*v:: do?
Does your game really require RCtrl to be held down?

Quadnick
Posts: 29
Joined: 10 Mar 2021, 20:14

Re: This simple script breaks Cemu/Call of the Wild

Post by Quadnick » 18 Jan 2022, 15:41

Hey, thanks for the reply. Both of your questions were answered in my original post, but I'll elaborate: RCtrl is my move forward key. Therefore, having it held down is essentially an auto-walk feature. The need for both of these, rctrl being my move forward key, and a script to hold it down for me sometimes, is due to my disability. My hands do not function, so I use a finger splint on each of my pointer fingers in order to press the keys on my laptop. With only being being able to press two keys at a time, the normal WASD layout doesn't work for me. I need to be able to split up my movement keys between my two fingers, so RCtrlBNM works a lot better. And it really helps to be able to toggle movement and sprinting.

As for the tilde and asterisk, these were a part of the script when I found it years ago. But from what I understand, from the research I've done to try and my make my own scripts, the tilde key makes it so the script fires upon pressing the key down, instead of the release. And the asterisk allows the script to trigger even if modifiers are pressed beforehand. Neither of these symbols are preventing this script from functioning properly though, if that's what you're thinking. Because as I also mentioned, I've been using this script for years without issue. And I have also tried using these other toggle scripts, without the symbols, but they are not working in the game either:

Code: Select all

v::
KeyDown := !KeyDown
If KeyDown
	SendInput {a down}
Else
	SendInput {a up}
Return

loop
{

LCTRL::
sleep, 200
loop
{
send {rctrl down}
if getkeystate("LCTRL")
break
}
send {rctrl up}

return
}
Despite the effort I've put into learning to write my own scripts, I still haven't got a good grasp of it. That is why I'm seeking help. Either these scripts do absolutely nothing in-game, or they behave in weird ways. I cannot figure out why.

User avatar
boiler
Posts: 16900
Joined: 21 Dec 2014, 02:44

Re: This simple script breaks Cemu/Call of the Wild

Post by boiler » 18 Jan 2022, 16:31

Quadnick wrote: But from what I understand, from the research I've done to try and my make my own scripts, the tilde key makes it so the script fires upon pressing the key down, instead of the release.
That is not true in your case or for most hotkeys. You are apparently referring to this part of the documentation:
Hotkey Modifier Symbols documentation wrote:If the tilde prefix is applied to a custom modifier key (prefix key) which is also used as its own hotkey, that hotkey will fire when the key is pressed instead of being delayed until the key is released.
...but your script isn't using a custom combination, so there is no custom modifier, and what you said does not apply.

This is the main thing that is relevant to the tilde modifier, including the hotkeys in the script you posted:
Hotkey Modifier Symbols documentation wrote:When the hotkey fires, its key's native function will not be blocked (hidden from the system).

This is easy to demonstrate. Run the following script and press and hold the A key. You'll notice that the MsgBox appears before you release the key, even though there is no tilde modifier:

Code: Select all

a::MsgBox, Hello
It will also do that if you add the tilde modifier. The difference is that if you include the tilde, an A keystroke is still sent to the active window when you press the hotkey. Without the tilde, it blocks the A key from being sent to the window (it is hidden from the system, so it is not sent anywhere). Try it with Notepad as the active window.

Quadnick
Posts: 29
Joined: 10 Mar 2021, 20:14

Re: This simple script breaks Cemu/Call of the Wild

Post by Quadnick » 18 Jan 2022, 17:25

Thanks for the explanation Boiler. It's been a while since I looked up what each symbol does. That must have been the one part that stuck with me. I did as you asked and I see the difference now. The original creator of this script had the tilde symbol included, so I just assumed it was important, and kept it. I'd be even more grateful if you could help me figure out why none of these scripts, even something as simple as e::a will work in the Cemu emulator. Or, if the emulator is affected by my script, it works in a completely unintended way. I've tried running as administrator, and using things like #IfWinActive/Exists, but nothing I've tried, or found on Google, is working.

User avatar
boiler
Posts: 16900
Joined: 21 Dec 2014, 02:44

Re: This simple script breaks Cemu/Call of the Wild

Post by boiler » 18 Jan 2022, 17:41

Quadnick wrote:
18 Jan 2022, 17:25
I'd be even more grateful if you could help me figure out why none of these scripts, even something as simple as e::a will work in the Cemu emulator. Or, if the emulator is affected by my script, it works in a completely unintended way. I've tried running as administrator, and using things like #IfWinActive/Exists, but nothing I've tried, or found on Google, is working.
I don’t know anything about your emulator, but it may just be that it doesn’t accept anything but actual physical keystrokes.

#IfWinActive and #IfWinExist won’t help the hotkeys work with any application or window. They just restrict when they would be active. So if anything, they could make it so the hotkeys do not work, such as if the WinTitle wasn’t identified properly. They cannot help hotkeys work when they otherwise would not.

Quadnick
Posts: 29
Joined: 10 Mar 2021, 20:14

Re: This simple script breaks Cemu/Call of the Wild

Post by Quadnick » 18 Jan 2022, 18:32

I'm using a program called mouse2joystick to be able to play on mouse and keyboard, and from what I can tell, the whole thing is an advanced autohotkey script. With it, I am able to toggle the ZL button from the Wii U gamepad it's emulating, and I am able to do that with my own custom key, which I set to period. I am also able to set my own keys for each gamepad button. I think it's possible, but man, it is just way above my paygrade. It can be found on github here: https://github.com/CemuUser8/mouse2joystick_custom_CEMU/releases and the script can be seen in the source file zip.

User avatar
boiler
Posts: 16900
Joined: 21 Dec 2014, 02:44

Re: This simple script breaks Cemu/Call of the Wild

Post by boiler » 18 Jan 2022, 21:01

I don't really know anything about that, so I don't know what to suggest. Maybe someone who is more familiar with it will be able to help.

Post Reply

Return to “Gaming Help (v1)”