Author Topic: I think I'm missing something, 'when i press keys'  (Read 1603 times)

Vindaloo

  • Newbie
  • *
  • Posts: 5
I think I'm missing something, 'when i press keys'
« on: May 17, 2022, 09:35:45 AM »
Sorry if I got this wrong but if I enter the letter E in this part of the new command, should the command be executed?

I have tabs in Elite and I want to track which one I'm on. Not a problem if I say 'show nav' my command will show the nav tab. I can then say 'show contacts' and it tabs across 2 to the contacts tab. This is then remembered in a profile wide variable.

What I would like is that if I use the 'E' key to change tab the variable containing the currently selected tab would be updated.

This would use a voiceattack command that does not work by voice command but the press of the key 'E'

Is this possible please?

regards
Jon

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: I think I'm missing something, 'when i press keys'
« Reply #1 on: May 17, 2022, 10:29:28 AM »
Provided keyboard shortcuts are enabled (I.E. there is no red icon over the keyboard icon on VoiceAttack's main window), under normal circumstances that should trigger the command, yes.

Vindaloo

  • Newbie
  • *
  • Posts: 5
Re: I think I'm missing something, 'when i press keys'
« Reply #2 on: May 17, 2022, 02:30:54 PM »
Ah thanks Pfeil. I thought the 'keyboard shortcuts off/on' was regarding using them while programming commands within VA. Yep, it's working in my test command in my 'basic' profile now thanks.

Is there a way to turn it on and off using voiceattack? I tried

Code: [Select]
// SetShortcutsEnabled(bool Value)
Begin Text Compare : [~passedText1] Equals 'on'
    Set Boolean [SetShortcutsEnabled] to True
    Write [Orange] 'Passed text = on' to log
Else
    Set Boolean [SetShortcutsEnabled] to False
    Write [Orange] 'Passed text = off' to log
End Condition

using the following extract from the manual:

SetShortcutsEnabled(bool Value) - This function turns VoiceAttack’s keyboard shortcuts on and off. Passing a true value turns the shortcuts on, while passing a false value turns them off.

but it doesn't appear to turn them on or off despite the correct word getting to the code. I then read 'back' in the manual and this 'SetShortcutsEnabled' appears to be linked to the vaProxy.command thing so I tried:

Code: [Select]
    Set Boolean [vaProxy.Command.SetShortcutsEnabled] to True
    Write [Orange] 'Passed text = on' to log
Else
    Set Boolean [vaProxy.Command.SetShortcutsEnabled] to False
    Write [Orange] 'Passed text = off' to log

but alas it did not do anything other than tell me on and off had been passed from the original spoken command as before. Then, having realised I'd gone way too far back in the manual (the correct section to read was on the same page as the SetShortcutsEnabled description  :-[ ) I tried the updated code:

Code: [Select]
    Set Boolean [vaProxy.State.SetShortcutsEnabled] to True
    Write [Orange] 'Passed text = on' to log
Else
    Set Boolean [vaProxy.State.SetShortcutsEnabled] to False
    Write [Orange] 'Passed text = off' to log

Yup still got the off or on from the log but still no action.

I would like them to be turned on when my game profile is activated as the game loads, and turned off again once I revert the profile back to the 'basic' profile.

If this can't be done it's OK, just so as I know.

Thanks
Jon

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: I think I'm missing something, 'when i press keys'
« Reply #3 on: May 17, 2022, 02:39:31 PM »
The "VoiceAttack Plugins (for the truly mad)" section of the documentation is relevant to writing external plugins or inline functions using supported .NET framework programming languages, not regular VoiceAttack commands.

There are actions that can be added to VoiceAttack commands that enable, disable, or toggle shortcuts, as noted in the "‘Other Stuff’ Screens" section of the documentation, and found in the "VoiceAttack Action" section of the "Other >" context menu.

None of them require the use of variables.

Vindaloo

  • Newbie
  • *
  • Posts: 5
Re: I think I'm missing something, 'when i press keys'
« Reply #4 on: May 17, 2022, 03:36:34 PM »
Thanks Pfeil. Having tested this idea of tracking key presses, by manually turning on the shortcuts, sometimes it get's out of sync with the actual tab and unless I then go into the additional commands to reset it it will just stay out of sync so I think I'm gonna give that a miss for now, but thanks for the info, I'll definately have a read through that section.