PDA

View Full Version : Hotkeys not working properly



Kelevraa
October 1st, 2020, 03:41
Am I the only one who can't get their hotkeys to work? I have a stream deck and it works exactly as expected in FG classic. But when I use my hotkeys in unity it activates the fkey first instead of (ctrl-fkey). Like I said, it works fin in classic and idk why it's not working in unity. It's kind of a bummer. Searched but didn't see anything.

Moon Wizard
October 1st, 2020, 03:49
I'm not following what the issue is. I'm not sure what stream deck refers to, and assume it is an external program or device.

However, the Unity game engine handles processing of key events differently than FGC does (due to being a cross-platform solution that works on Windows, Mac and Linux). If you press a function key while FGU is up, it should process the key stroke.

Regards,
JPG

Sgain
October 1st, 2020, 06:40
I have the same issue. Hotkeys seem to not work right in FGU. I use a macro keyboard for editing and I noticed about a month ago that FGU stopped working with it.

LordEntrails
October 1st, 2020, 16:46
I'm not following what the issue is. I'm not sure what stream deck refers to, and assume it is an external program or device.
External device. It has a bunch of programmable buttons. https://www.bhphotovideo.com/c/product/1378121-REG/elgato_systems_10025500_stream_deck.html

Sounds like FGU interprets the incoming key strokes differently when coming from the external device and the keyboard. Can one of you test that? Do the hotkeys work normal when using a keyboard?

Since the Stream Deck is a device, does it have a setting for language? I know different keyboards can send different binaries for similar keys, perhaps it's related to this? Does it matter what keyboard settings you are using?

Kelevraa
October 1st, 2020, 21:55
I'm not following what the issue is. I'm not sure what stream deck refers to, and assume it is an external program or device.

However, the Unity game engine handles processing of key events differently than FGC does (due to being a cross-platform solution that works on Windows, Mac and Linux). If you press a function key while FGU is up, it should process the key stroke.

Regards,
JPG

It is an external device, true, although what it's doing is just setting up standard macros. Which executes multi-button functions into one. Any FG hotkeys that try to use ctrl, alt, or shift don't function properly with the macro because FGU is executing the fkey first and ignoring the modifying keys. (I honestly don't know how else to explain it, sorry. I might not be using the exact proper terminology. I'm faux computer savvy)

It's not registering ctrl, alt, or shift when it executes the macro. Which it seems someone else has also noticed. If I hold the hotkey, eventually the proper FG shortcut starts flashing like mad, but that isn't useful at all. It did work fine in classic as a side note.

Also as a side note, a stream deck is a very usefull tool far outside it's target audience of streamers. It's context based macro buttons that can control nearly anything your computer does with custom icons/buttons that can change based on what program you are using. It's a wonderful piece of kit. I thought the biggest model was overkill but after using it I can't stop finding more uses for it.

Moon Wizard
October 1st, 2020, 22:13
The FGC system is Windows only and uses the default Windows key press events.
The FGU system is based on the Unity game engine, and uses the events provided by the Unity engine to track modifier keys.

So, we don't have much control over how keys are interpreted in the Unity game engine, and I don't have a stream deck I can use to test with to even see if there is anything we can do.

Can the macros be programmed differently for modifier keys to mimic more direct key press and hold events?

Regards,
JPG

Kelevraa
October 1st, 2020, 23:57
Not in any immediately obvious way. But I can try. Just thought it was odd cause macros usually work as intended for every game/program I've ever used. I have other macro software I can test also.

Kelevraa
October 2nd, 2020, 00:25
Ok, I am using another macro software/hardware (razor nostromo) that allows me to set the order of button presses and I know for a fact ctrl is input first and FGU still executing the fkey first and the hotbar flashes as if ctrl IS being pressed. But it isn't executing the ctrl + F1 hotkey. I will now play with delays.

Ok, if I input a deliberate delay then it works. Although, this does slow down the macro and sort of the reasoning for having it (speeding up hotkey and multi-button usage). It is still an OK solution, but not great. Anyway, I can try to find a way to add delays to streamdeck macros. Unfortunate situation it seems if you say there is nothing that can be done =[

Moon Wizard
October 2nd, 2020, 00:40
It sounds like the key down and key up event for the modifier key are triggering before the key down event for the function key. I would expect most macros to track key down and key up in order. That's why I was wondering if there was something to specify "hold key until I specify it to be released".

JPG

Kelevraa
October 2nd, 2020, 00:44
The Nostromo actually tracks the keydown and keyup. So it looks like this

ctrl down
f7 down
f7 up
ctrl up

But in FGU its still executing normal f7 and flashing the ctrl press. Obviously, the overly delayed version works but undermines the intended use.
I obviously don't know how FGU interprets these key presses as I think they are like .05 seconds apart.

Moon Wizard
October 2nd, 2020, 01:22
Like I mentioned, we're pulling KeyDown and KeyUp events and KeyPressed state directly from the Unity game engine; so not sure why it would not work as expected. (Unless there is some sort of issue with certain programs or the Unity game engine when using Nostromo.)

Regards,
JPG

Kelevraa
November 13th, 2020, 02:31
I just wanted to keep this conversation alive, because it's so tedious and limiting... and incredibly odd in a modern program.

Has anyone got single press, multi-button macros to work in FGU?

StylinLP38
December 5th, 2020, 21:43
Its December now. Have you guys figured out how to get Elgato to worth with FG? Im planning on using my 15 key version for Syrinscape, Discord and launching all the apps.

Kelevraa
December 5th, 2020, 23:10
Nope. The only responses I got were on here and very deflecting. Like it's the Elgato's or my fault. FG Classic works as it's supposed to, but Unity doesn't seem to support ANY multi-key macros at all. I've tried 4 different devices and a few softwares. It just inputs the f-key first every single time. I've gone very deep and even adjusted the milliseconds in the delay that the macro "holds" down the ctrl/alt/shift buttons BEFORE it "presses" the f-keys. No dice. And with the "user error" mentality I hear back I doubt it will get looked at any time soon.

Maybe if enough people complain and/or explain how insanely beneficial macros are they will fix it. I can still use it for sound effects and pulling up my books outside FG, but it's nice to pull up individual character sheets, rules, and menus with a contextual button menu. It's pretty slick in classic. I loved it. Such a shame a paid upgraded version has less functionality.

If anyone has a different experience. I'm all ears.

[edit- They are always updating and I haven't tried in a couple of weeks. So you never know. But it sounds foundational and unfixable according to the responses I've heard here]

Sulimo
December 5th, 2020, 23:50
I did not get the impression that Moon Wizard was blaming users at all from his posts.

What he did say was that the Unity Engine (https://unity.com/) is not interpreting the key press events from those devices as you might expect.

With FGU, the Unity Engine handles all of the heavy lifting as far as the key presses are concerned. So, it looks like it is more of a Unity thing, instead of specific to FGU.

I know that may not be what you want to hear, but I am not sure that FG devs can do a whole lot to modify the underlying engine. They have to take what the engine gives them.

I did find this (https://github.com/nicollasricas/streamdeck-unity), but I have no idea how (or if) it works, as I do not have one of the devices. It does seem to indicate that there is an issue with Unity key presses and the hardware, if someone went to the trouble to create a Unity integration package for it.

Kelevraa
December 6th, 2020, 11:19
I'm going to try and re-explain the actual issue at hand here. The devices and software... have nothing to do with it. As far as anyone has been able to tell me and as far as I have seen. No macros work at all. None. From any device. From any software. In any shape or form. No single-press multi-button macros work with the FGU hotkeys. FGU cannot seem to handle a macro that attempts to combine shift + f1 in a single button press. Which is... bananas in the year 2020. Literally unbelievable in the sense that I don't believe that it can't be done in unity.

That link you got seems to be for developing in unity and accessing various menus related to that. People put together all kinds of program-specific packages for the stream deck. Not because it doesn't work, but because it does. I'm not trying to access development menus. I'm just trying to execute ctrl+f4 with a single button. But, it always just kicks back f4 first. And it works as intended literally everywhere else for the past 20+ years of macro use. So it feels like a mistake or oversight rather than something that "can't" be done.

Weissrolf
December 6th, 2020, 12:20
The culprit is that FGU is not able to receive fast modifier + F-key successions, not even from normal physical keyboards. FGU needs to first receive a modifier key to be held down for some time to switch its shortcut bar and only then it can receive the F-key.

In tests on my computer the minimum delay was 40 ms, anything lower would at least sometimes lead to the modifier key not being registered, even when no other load was present. So something like this works:

{CTRL down} + 40 ms delay + {F1} + 40 ms delay + {CTRL up}

A quick search revealed that the Stream deck supports delays, but I did not find it supporting modifier down/up commands?! It may support setting a global/per macro key-delay (delay between each multi-key) maybe? If it does not offer either then you need to use software like AutoHotKey as workaround (SendEvent mode, not SendInput/Play).

FGU (or Unity) also needs to step up their game in regard to keyboard input latency/delay, though.

Jiminimonka
December 6th, 2020, 14:35
I'm not getting involved in any discussion about the whys or ifs - just want to ask a question - Why is an Elgato stream deck useful in FantasyGrounds? Or are you using it for streaming and some how FGU is messing with the scene changing etc.?

Zacchaeus
December 6th, 2020, 14:56
I'm going to try and re-explain the actual issue at hand here. The devices and software... have nothing to do with it. As far as anyone has been able to tell me and as far as I have seen. No macros work at all. None. From any device. From any software. In any shape or form. No single-press multi-button macros work with the FGU hotkeys. FGU cannot seem to handle a macro that attempts to combine shift + f1 in a single button press. Which is... bananas in the year 2020. Literally unbelievable in the sense that I don't believe that it can't be done in unity.

That link you got seems to be for developing in unity and accessing various menus related to that. People put together all kinds of program-specific packages for the stream deck. Not because it doesn't work, but because it does. I'm not trying to access development menus. I'm just trying to execute ctrl+f4 with a single button. But, it always just kicks back f4 first. And it works as intended literally everywhere else for the past 20+ years of macro use. So it feels like a mistake or oversight rather than something that "can't" be done.

The issue does seem to be that the Unity engine isn't picking up the input. See here; this might help https://www.reddit.com/r/ElgatoGaming/comments/ctowf8/streamdeck_unity/

Most of what I found with a Google search was from people trying to do what you are trying to do with the Unity engine - and failing.

Weissrolf
December 6th, 2020, 15:23
Well, like I wrote, it does work via AutoHotKey, but the delay needed seems too high for a game-engine (especially while a Windows timer resolution of 1 ms is enforced).

Kelevraa
December 6th, 2020, 16:28
Well, like I wrote, it does work via AutoHotKey, but the delay needed seems too high for a game-engine (especially while a Windows timer resolution of 1 ms is enforced).

I have tried using custom delays. I went much farther than 40 ms also. But, if you claim it works then I will give it a few more goes. My first problem is just getting it to work at all. I really hope you are correct and I can get it to work.

Weissrolf
December 6th, 2020, 16:37
I don't know which methods you tried, but using AutoHotKey you need to make sure to use Sendmode Event (or SendEvent), because Input and Play ignore keyboard delays.

Using smaller delay than 40 ms did work, but there it did not take long until a modifier key down was not recognized by FGU then. 40 ms worked for the short tests I did (no additional CPU load). My test was simple: hit CTRL+F11 every 0.5 seconds, which in turn rolls a D6. If the CTRL key is missed a D4 is rolled via F11 instead.

You also need to make sure that you send the modifier down explicitly. So {ctrl down}{f11}{ctrl up} works, but ^{f11} does not.

Kelevraa
December 6th, 2020, 16:57
I'm not getting involved in any discussion about the whys or ifs - just want to ask a question - Why is an Elgato stream deck useful in FantasyGrounds? Or are you using it for streaming and some how FGU is messing with the scene changing etc.?

It's incredibly useful for any software. It's a contextual macro board. In FG I have a button for combat. When I press it, all 15 buttons change to "combat" mode and I have one that brings up the combat tracker, another for an extension that helps call for rolls, another for "rules" which itself is a submenu that then changes all the buttons to show links for status effects, actions, and other rules brought up from the fantasy grounds reference pages in the official books I've paid for.

I have buttons for each character sheet, a sound effect board my players hear on discord, and all the dice rolls. All set within contextual menus and customized icons. Like most productivity quality of life upgrades, if you never use it then you wont miss it. Although after using it in classic I find it so useful that not having it in unity is very vexing.

I also have links to webpages I use during the game for various random generation, a timer used in combat, and the list is only as long as your imagination. You can also do more advanced things like setting up your encounter ahead of time and open the combat tracker, the map, the npc sheet/s, the encounter window, the treasure parcel should they win, change the bg music, and pull up the rules for combat... all with a single button press. When they work. The Elgato only makes the macros visually context-based which is helpful for submenus. Allowing my 15 button stream deck to have hundreds of functions with visual icons instead of trying to remember what combination of ctrl/shift/alt everything is.

Kelevraa
December 6th, 2020, 17:06
I did try sending the actual down and up inputs explicitly, with delays, using various lengths of time. None of it worked. But you're the first person to say it's even possible so I will continue my torture tests.

Weissrolf
December 6th, 2020, 17:36
You might have to put a simple AHK script in between to catch any CTRL+f-key combination and then resend it via AHK's methods. It's awkward, it should not be necessary, but at least I can confirm that AFK SendEvent + SendKeyDelay works for FGU.

Kelevraa
December 6th, 2020, 18:05
I just tried it with a 40ms delay and a 200ms delay after ctrl-down and it still registers the fkey first. Just with the longer delay. I am using BarRaiders "Super Macro" which is similar to AutoHotkey in that you can program every event manually. So I'm doing exactly what you have written with no dice. {ctrl down}{f11}{ctrl up} just gives me the fkey no matter how long of a delay I put in after ctrl down. I am now trying to use the same software you claim is working (although I don't call all this "working" to be fair). Do you have a screenshot of the file you wrote that works?

Weissrolf
December 6th, 2020, 19:15
I can see FGU's shortcut bar switch back and forth while this script runs in its loop. It's part of a longer script, but I only pasted the relevant bits.


toggle=0

F12:: Goto ClickIt

ClickIt:
If (toggle := !toggle)
SetTimer, Timer, -1
return

Timer:
setkeydelay 40
while toggle
{
SendEvent {ctrl down}{f11}{ctrl up}
Sleep, 500
}
return

Kelevraa
December 6th, 2020, 19:25
You might have to put a simple AHK script in between to catch any CTRL+f-key combination and then resend it via AHK's methods. It's awkward, it should not be necessary, but at least I can confirm that AFK SendEvent + SendKeyDelay works for FGU.

This is it, or at least it directed me to the workaround that finally worked with the software I have with full controls. I tried so many things similar but when you said something like "resend" a light bulb went off. Even the developers were showing me how to do it all in a single line within one giant set of {}. And it all worked as intended... other than FGU and the fkeys.

I had to separate all the key strokes into their own lines with their own set of double {}. Which, based on what the developers were saying and the examples given, is unnecessary. But FGU makes it necessary. I still believe there is something that can be done to allow standard macro usage to work. I can't fathom modern software in 2020 "can't" have this basic functionality.

Until then, doing 3x the work for every single macro is just going to be the way it is for now.

Thanks for verifying Macros work at all Weissrolf. This was the core of my question and concern. You're input led the way for me.

Weissrolf
December 8th, 2020, 08:27
If you put each the modifier and f-key in {} then the key delay is performed in between them. This is why for AHK I wrote earlier that ^F11 does not work where {shift down}{F11}{shift up} does. The former introduces no key delay in between, but the latter does.

Weissrolf
December 9th, 2020, 23:19
Worth mentioning that my right-click drag script does not need a delay between the modifier key and the mouse-button press. So the shortcut-bar is special in this regards.

I also don't expect Unity to need such a delay by itself, because it is a game-engine and games use low-latency modifier key-combinations for all kind of things regularly.