Author Topic: Variable keypress  (Read 4635 times)

Malic

  • Full Member
  • ***
  • Posts: 102
Variable keypress
« on: October 13, 2018, 07:18:22 PM »
I am not sure if this is possible.

I am using BindED to get all my keybinds from Elite: Dangerous, but lets say one user has Tab as the boost key, and another has U key.

I cannot find any way for VA to look for the key that the user has so when they hit boost, it runs a command.

My command is also using EDDI to see if cargo scoop or landing gear is down and retracts before pressing boost again in case they are down

Have tried to search for anything relating to variable keybinds, and can only find a few feature requests a while ago

https://voiceattack.com/SMF/index.php?topic=1658.msg7774#msg7774

https://voiceattack.com/SMF/index.php?topic=2185.msg10120#msg10120

https://voiceattack.com/SMF/index.php?topic=582.msg2872#msg2872


Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Variable keypress
« Reply #1 on: October 13, 2018, 07:42:02 PM »
Currently, "Variable Keypress" only applies to sending keyboard input, not receiving it. You can't directly trigger a command using a dynamically-set arbitrary key.


In theory you could use a loop inside a command running in the background to trigger other commands, but that has a number of drawbacks, including performance.

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2827
Re: Variable keypress
« Reply #2 on: October 13, 2018, 08:12:25 PM »
This is something that *could* be implemented, but I drag my feet on this because it *would* impact key hook performance.  Essentially, every time a key is pressed, all variable shortcuts would need to be rendered first before any processing.  It could be implemented by only rendering the variables on profile reset... not really desirable, I'm sure, and I don't want to add yet another action just to refresh.  Might be fun just to investigate, though.

Malic

  • Full Member
  • ***
  • Posts: 102
Re: Variable keypress
« Reply #3 on: October 14, 2018, 04:32:11 PM »
Yeah, way I am doing things right now, am making an Elite Dangerous profile.  Already using Bind ED to read the keybinds, but the command that I created that started to cause this OP to be made...

Wrote a command that looks at when I press the boost button.  If I press the boost button, it would normally boost.
However, if the cargo scoop or landing gear is out, boost does nothing, and just as a convenience thing, and because pirates tend to jump in right as you are scooping cargo, put in a check though EDDI for cargo scoop state, if extended, retract and hit boost again. 

In my testing works awesome, however, am trying to see if we can get this variable keypress to read the binds and have it look for whatever key the user has assigned.

This is the first command that I needed this kind of function, have been trying to make profile as painless of an install as possible, this is only one that requires the user to set their own key (so far)

I have already created a completely separate command that uses C# and such that downloads a CSV google sheet that adds in functionality so you get alerts on entering systems that have things, can target/type system names or ask it where a thing is and even give Lat/long (and can even open it into a compass program that leads you to the surface) and it is using a variable for the "when I say" portion, and does the reset on startup, etc, but just cant do that with keys presses yet :p

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2827
Re: Variable keypress
« Reply #4 on: October 20, 2018, 10:15:02 PM »
I've got some work done on variable hotkeys...  should have something out soon (some more testing needed).

I profiled this a bit and found that it would be rather easy to hamstring VA on hotkey presses if the variables were checked and rendered every time a key was pressed.  So, I opted to add an action that refreshes the hotkeys without resetting the entire profile.  When a variable is changed that could affect hotkey monitoring, you just execute the action and monitoring is refreshed with the new values.  It's an extra step that I hate having to add, but for performance I think it would be much more welcome.

There will be a checkbox on the hotkey screen with an input box.  That box will accept a text variable name (no tokens, although if you want to live dangerously, the variable can contain tokens since the underlying parser processes tokens (you've been warned - lol - your hotkey combo could end up being, 'NOT SE(T)'))  The text variable must be global or profile-scoped. 

Something fun is that as an added benefit, the variables go outside of the bounds of the UI, so, you can have more than modifiers and a single key as a hotkey.  Have a 20-key shortcut if you want.  Go crazy ;)


Edit - New beta out there.  Hope that's what you re looking for!
« Last Edit: October 21, 2018, 08:48:44 PM by Gary »

Malic

  • Full Member
  • ***
  • Posts: 102
Re: Variable keypress
« Reply #5 on: October 23, 2018, 12:51:44 AM »
yep, am going to be testing things with it tomorrow, thank you <3