FAQ  •  Register  •  Login

Problem with a keymap turning off while holding a mapped key

Moderator: MiRai

<<

stebel

Posts: 4

Joined: Tue Sep 24, 2013 7:52 pm

Post Tue Sep 24, 2013 8:15 pm

Problem with a keymap turning off while holding a mapped key

Hello,

I'm trying to use one of my mouse button as a modifier. To do this I added a new mapped key triggered by my mouse key that executes a step on press or release. The first step turns on my desired keymap and the second one turns it off.

So far so good, except for one detail. Some of the mapped keys in my activated keymap have the "Hold any Keystroke Action while Hotkey is held" attribute set to on. In this case this is necessary because I use these keys for movement.
The problem occurs if I release my mouse key before releasing any keyboard key pressed while the keymap was active.

Here are some debug traces showing the problem:

Key Map: 'FFXIV-Movement' loaded
Button: from keystroke@is1: hold D
Key Map: Unloading 'FFXIV-Movement'

Key Map: 'FFXIV-Movement' loaded
Button: from keystroke@is1: hold D
Button: from keystroke@is1: release D
Key Map: Unloading 'FFXIV-Movement'


As you can see, my D key was held but never released. The second block of traces is me reactivating the keymap and pressing D again. In the meantime, the game (FF XIV) was acting as if my D key was held down, sending my characters wherever since that key is mapped to my walk backwards action in game.

I've put a short timer on the turn off action on my second step so that if I release both keys near simultaneously, things work as expected. But I still get in trouble because of this often enough that I'm looking for a better way.

Thanks for any help.
<<

firescue17

User avatar

League of Extraordinary Multiboxers

Posts: 585

Joined: Wed Sep 19, 2012 7:37 am

Location: Omaha, NE

Post Tue Sep 24, 2013 9:37 pm

Re: Problem with a keymap turning off while holding a mapped key

stebel wrote:I've put a short timer on the turn off action on my second step so that if I release both keys near simultaneously, things work as expected.

I have run into this situation myself. Your assessment of the situation is accurate; with the Mapped Key turned off the Keypress up is never sent. This thread discusses the particular issue I encountered, albeit in reverse. I was losing the Keypress Down action.

I settled on a solution that works 99% of the time; although, it will very, very, rarely jam up if the timing is *just so.*

This involves a double kill switch (or activate switch depending upon your perspective). Instead of using a two-step Mapped Key, I broke the Keypress Down and Keypress Up actions into separate, single step Mapped Keys. I then call those Mapped Keys in a separate two-step Do Mapped Key. In short:

Mapped Key #1; Name = <Sub: Keypress Down>
Step 1: Various actions I want executed on Keypress Down


Mapped Key #2; Name = <Sub: Keypress Up>
Step 1: Various actions I want executed on Keypress Up


Mapped Key #3; Name = <Do Keypress>
Step 1: Do Sub: Keypress Down
Step 2: Do Sub: Keypress Up

At this point you have isolated your various actions into separate Mapped Keys which do not rely on a specific Mapped Key *Step*. From there, bind the mouse button to Mapped Key #3 Do Keypress (or whatever you named it). **IN ADDITION** add a secondary Do Keypress Up on a short timer such as .5 seconds as you already have. You now have two kill (or activate) switches.

Most of the time, pressing and releasing the mouse button will do the appropriate actions. On the rare occasion the press/release order gets outta whack and stuck, the timer action will duplicate the Keypress Up actions and turn off (or on) the stuck movement action.

I hope this helps. It's complicated to explain without a profile to work with. Feel free to ask for clarification.

EDIT: I dunno if this will work for your particular situation. If the movement key is getting stuck in the on position, we might have to do something else since there's no way to send a Key Press or Release on a timer. If this doesn't do it, I have another idea.
<<

stebel

Posts: 4

Joined: Tue Sep 24, 2013 7:52 pm

Post Wed Sep 25, 2013 8:57 pm

Re: Problem with a keymap turning off while holding a mapped key

Hi firescue17,

Your examples inspired me to explore a couple of new approaches. I tried, a bit like you did, to load a separate keymap on mouse down and up. Unfortunately I did not see a way to make that work for my needs with held keys.

Instead of loading a keymap on down/up of my mouse modifier I also tried altering steps on a movement mapped key.

Basically I set a mapped key with two non advancing steps. First step sends D to my current window, second step sends D to all. My mouse modifier down set the step to 2 (so everyone receives the D) and on mouse release set the step back to 1.
This looked promising but in the end it suffers from more or less the same problem I have with unloaded keymap. If I release the D key after the action has been put back to step 1, my other windows never receive the 'D released' event. Back to square one.

If innerspace took care of applying the release event to the same target windows that received the hold event that would of course fix the problem very cleanly. Or if we could trigger actions on hold/release for held keys it would probably be doable to handle things properly. Another, perhaps even better, way to do what I'm trying to do would be the ability to set hotkeys to trigger on multiple keys (e.g. trigger a mapped key if mouse4+D are pressed together).

As things are now it doesn't look like it's possible to use a mouse button to act like a modifier key and have it work 100% of the times. I'd love to hear any ideas to make that work I may have missed.
<<

firescue17

User avatar

League of Extraordinary Multiboxers

Posts: 585

Joined: Wed Sep 19, 2012 7:37 am

Location: Omaha, NE

Post Thu Sep 26, 2013 12:42 am

Re: Problem with a keymap turning off while holding a mapped key

Some random thoughts:

1) Can you post your profile so I can see what you're doing and we can use common Mapped Key names?

2) I'm assuming this is used to control movement on other Characters? Push Mouse 4, it turns on a Key Map. While this Key Map is on, holding "D" sends a movement to other Characters, but not the focused window?

3) The issue arises if Mouse 4 is released prior to releasing "D," the Characters scatter off on their own because they never receive the release, still think D is being held down, and continue to move in that direction?

4) If #3 is true, do you want them to always stop so the Characters don't scatter?
<<

stebel

Posts: 4

Joined: Tue Sep 24, 2013 7:52 pm

Post Thu Sep 26, 2013 7:20 pm

Re: Problem with a keymap turning off while holding a mapped key

Here are the two keymaps involved:

http://www.privatepaste.com/0abd0b81cf FFXIV-Non-Combat
http://www.privatepaste.com/2904f5c065 FFXIV-Mouse5 (This map is activated on the "Mouse 5 Modifier" mapped key in FFXIV-Non-Combat)


The scenario I was hoping for is something like this:
The movement keys in FFXIV-Mouse5 mirror my normal movement keys.

1. Press D. This is my move backward key and since it is unmodifed my main moves back.
2. Press my mouse button 5 modifier to load my FFXIV-Mouse5 map. In this map D is broadcasted to all but main. My main character should stop, and all others should start to move back.
3. I release mouse 5. The map is turned off, the mouse events should revert back to my main. So now everyone else stops, and my main starts to walk back.

That would be perfect. Otherwise I would be pretty happy if there was a way to be sure that whatever window received the key down event also gets the key up event when I release the key.

I like the setup in the pastes above because it's pretty clean and simple with all the modified keys collected in their own keymap. As long as I'm careful to release the movement keys in time, it works pretty well.
But in the heat of battle my attention wanders to other things and my fierce companions quite often turn into headless chickens that do not always stay were I want them to. :)
<<

firescue17

User avatar

League of Extraordinary Multiboxers

Posts: 585

Joined: Wed Sep 19, 2012 7:37 am

Location: Omaha, NE

Post Thu Sep 26, 2013 9:44 pm

Re: Problem with a keymap turning off while holding a mapped key

Ok. I get the gist of what you're trying accomplish. Another suggestion:

In Step 2 of "Mouse5 Modifier" (the release) you could try adding a straight key broadcast of D *With Hold OFF* to All w/o Current. Add this below the Keymap off Action so it is processed after the Keymap is turned off. If you inadvertently release Mouse5 prior to releasing "D", that *may* send a quick stutter-step press and release to break the backward movement and compensate for the missing "D" release from the Keymap itself.

With Hold off, there may not be enough time for "D" to be detected. If that doesn't work, you could try the same method, instead broadcasting the *opposite* direction - send a straight key broadcast of whatever you're using for "Others Move Forward."

If that doesn't work, you could try either of the above methods with Hold On.

I would guess breaking the movement is going to cause one, the other, or possibly both "Window: Current" and "Others" to stutter-step. I doubt it will be a smooth transition, but I imagine that's better than having the boxes scoot off of their own accord.

Heh, I'm curious to see how this turns out.

EDIT: Corrected the movement directions.
<<

stebel

Posts: 4

Joined: Tue Sep 24, 2013 7:52 pm

Post Sat Sep 28, 2013 6:43 am

Re: Problem with a keymap turning off while holding a mapped key

You are right firescue17, sending the correct key with hold off to a slot that did not receive the key release event does correct the situation. The problem then becomes how can we send the correct key at the correct time?

I tried a few things, and while I was getting close to a pretty good solution as far as behavior, the implementation in ISBOXER was growing quite complex and very messy so I decided to try from of a different angle.

My new solution:

My modifier (mouse5) no longer activates a keymap for my movement keys, rather it populates the FFXIV-Movement ATG with "all other slots" on press and with "current slot" on release. So FFXIV-Movement has normally one slot in it, but contains the other three when mouse5 is pressed. This is pretty flexible because I can now define other keys to add whichever slots I want to FFXIV-Movement and everything else works correctly (e.g. if i add all slots to FFXIV-Movement, evey characters will respond).

I know have a keymap, also called FFXIV-Movement, that is loaded from the start. This keymap has my movement keys (held) that send the corresponding keypresses to the FFXIV-Movement ATG. In my previous post I mentioned that being able to trigger actions from press or release on held keys would be useful. It turns that we can do it! Just a little indirectly.

In addition to my movement mapped key (held) I have duplicate mapped keys with hold off set to the same hotkey. For instance, pressing D, will trigger my Back mapped key (with hold ON) that sends the D key to the game. Pressing D also triggers my other mapped key which has two steps, one for press, one for release. On press it keeps a copy of the FFXIV-Movement ATG in its own ATG. This records the target slots that received the key down event. On release, the mapped key sends its associated key (e.g D) to its private ATG. So even if the FFXIV-Movement ATG has changed, which means the key release event will not be sent to the correct slots by the "held" mapped key, the new key press/release will go to the correct slots.

So for these mapped keys to work I need 5 ATG (FFXIV-Movement, FFXIV-Movement-Left, FFXIV-Movement-Forward, FFXIV-Movement-Right, FFXIV-Movement-Left, FFXIV-Movement-Back). They are all empty at the start. One final detail is that on my focus slots mapped keys, I have to make sure to set the new foreground slot in my FFXIV-Movement ATG.

With this I can now press my movement keys and mouse modifier key in pretty much any order without anything breaking. Movement keys remain in effect until released which is pretty intuitive. This also works well with multiple movement keys pressed at the same time.

I haven't done extensive testing, but so far it seems pretty robust with no stuck keys or strange behavior.

Here are my keymaps that implement all this:
http://www.privatepaste.com/6d12d610c8 FFXIV-Movement : This has all the movement keys. The ones named "- PR" are implementing the press/release logic.
http://www.privatepaste.com/7bffd5ebe1 FFXIV-Non-Combat: The interesting mapped key is Mouse 5 Modifier, it shows how I keep the FFXIV-Movement ATG populated.

Thanks again for your help firescue17.

Return to Key Maps

Who is online

Users browsing this forum: No registered users and 2 guests

cron