Author Topic: How to: Ignore key strokes in certain game areas or: Consistently track states?  (Read 4922 times)

PhoenixHawk

  • Newbie
  • *
  • Posts: 4
Hello fellow Voiceattackers,

I have a question regarding a certain aspect of VA programming: I use VA to keep track of some states in variables (values). I have several ways of toggling these: Joystick inputs, certain keys, voice commands.

For example in my setup for Elite: Dangerous the button 'L' is toggling lights, as well as a certain button on my joystick. I don't just want a command 'Toggle lights' in VA, but 'Lights off' and 'Lights on', that should not do anything if the lights are already in the correct state. I also have more complex commands like 'Landing mode' which turns on the lights as well as extend the landing gear and 'Flight mode' which retracts the cargo bay, retracts the gear and turns off the lights, when any of these are necessary. My approach would be to track the individual device states in a value in VA.

Now I would have a boolean value in VA for the lights state, and toggle that on the press of 'L', the joystick button and on the corresponding voice commands when they actually toggle the state.

The problem:

There are certain areas in the game like a map search input and in-game-chat where I want to be able to press 'L' in the input fields without having VA toggle the variable state, as pressing the key there does not toggle the lights in-game.

Now I could, theoretically, try to track all actions leading to such inputs and hopefully all actions that lead to leave these areas to disable and enable keyboard tracking of these states.

However, I usually open the Map by voice or key command, but there are other ways to open the map (i.e. from a sub-menu of the current active missions) where I select the map with the joystick. I cannot think of means to reliably track these.

I also don't want to manually disable key recognition, because I think I would in most cases simply forget to do that, screwing the states of all my values.

So, do you have any ideas on how to solve this with VA?
Also if there is a better way in general, please point me to that ;-)


iceblast

  • Sr. Member
  • ****
  • Posts: 374
Hmm, you can link the map command to turn off hot keys, and when you turn off the map, it re-enables. Of course, if you trigger it by menu, VA won't have any idea. So, you would have to keep that in mind, and manually turn hot keys off and on.

Just do the same with any feature you want to actually type.

There could be a better way, but I would have to use ED to test them. As long as you are triggering these other things you want to do, with a keyboard, Voice, or Joystick command, you can also turn on and off hot keys.

You could even add a command to some of your most used actions, to check if Hot keys are on, and if they aren't to turn them on, as a failsafe if you forget. Just remember not to trigger those actions while trying to type, and won't them off. :)

No idea if this will help. Thought I'd give it a shot. :)

iceblast

  • Sr. Member
  • ****
  • Posts: 374
I was just thinking, if hot keys are off, you won't be able to turn them on with the keyboard. :) oops.

Instead of turning off Hot Keys, when you trigger map, or chat, have it switch profiles, and switch back when you turn it off. You can do the same with your most used actions keys, to switch to your main profile as a failsafe.

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Since VA just went through a keyboard overhaul, a hotkey to turn keyboard shortcuts on and off would be ideal.

Sorry for the short post... I'm on my way out the door o_O

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
I was just thinking, if hot keys are off, you won't be able to turn them on with the keyboard.

For now, you can work around that:

Code: [Select]
Disable Hotkeys
Start Loop While : [{EXP:1=1}] Equals '1'
    Begin Text Compare : [{STATE_KEYSTATE:NUMENTER}] Equals '1'
        Enable Hotkeys
        Exit Command
    End Condition
End Loop

The loop checks the state token of a certain key("Numpad Enter" in this case, for convenience), which isn't affected by disabling shortcuts.

I've used the same technique here.