Author Topic: Is it possible to run VA with 2 different PTT ?  (Read 5308 times)

Windblow

  • Guest
Is it possible to run VA with 2 different PTT ?
« on: February 14, 2018, 08:04:06 AM »
Hi all,
I Am discovering VA and ARMA3 running together, nice feeling.
THis is my first post here. I did a seach request before writing

I mostly fly Falcon BMS too. In the Flight sim, you have 2 different channels : UHF and VHF.
ON the throttle, I have 2 different PTT, one for each channel. It is compulsory if playing online
Can i use VA in the same way ? I mean if I push UHF ptt and say a VHF command, as i am on the wrong channel, nothing happen, and vice versa?
Any tips ?
« Last Edit: February 14, 2018, 09:07:20 AM by Windblow »

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4591
  • RTFM
Re: Is it possible to run VA with 2 different PTT ?
« Reply #1 on: February 14, 2018, 02:40:15 PM »
You can set this up by using commands to trigger push-to-talk:

Code: [Select]
Start VoiceAttack listening
Set integer [PTTChannel] value to 1
Start Loop While :  Keyboard Key 'Left Alt' Is Pressed
End Loop
Set integer [PTTChannel] value to 0
Stop VoiceAttack listening
Use the "When I press keys" option to map a key(combination) to the command, and set the Loop Start to the same key(use the condition builder to add all the keys as "And" if you use a combination).

Then, you can paste this at the top of any command that would only run when the correct PTT key is down:
Code: [Select]
Begin Integer Compare : [PTTChannel] Does Not Equal 1
End Condition - Exit when condition met

Change the "PTTChannel" value from 1 to something else(other that 0, which is the "off" state) for your second PTT command.

Windblow

  • Guest
Re: Is it possible to run VA with 2 different PTT ?
« Reply #2 on: February 15, 2018, 01:26:05 AM »
Thanks Pfeil for answer.
It makes sense and I have the way now. I will implement this and let you know here the result. :-)

TwanV

  • Guest
Re: Is it possible to run VA with 2 different PTT ?
« Reply #3 on: February 21, 2018, 06:00:20 AM »
Dear Pfeil,

I tried to implement your suggestion but sadly no-joy yet: The While-condition of a keyboard key being pressed cannot be selected from the corresponding menu. Is there any way of implementing such a condition outside the while-loop menu?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4591
  • RTFM
Re: Is it possible to run VA with 2 different PTT ?
« Reply #4 on: February 21, 2018, 06:55:20 AM »
The While-condition of a keyboard key being pressed cannot be selected from the corresponding menu. Is there any way of implementing such a condition outside the while-loop menu?
That feature was implemented in beta v1.6.9.1, so you don't have it if you're running the current release version(v1.6.9).

In the release version you can do it the "old fashioned" way using tokens(which go in the "Text" tab of the "Loop Start" action):
Code: [Select]
Start Loop While : [{STATE_KEYSTATE:LALT}] Equals '1'
End Loop
If you want a key combination, you can add tokens for those:
Code: [Select]
Start Loop While : [{STATE_KEYSTATE:LALT}{STATE_KEYSTATE:A}] Equals '11'
End Loop
Because each token returns either "0" or "1" as text, you can add more "1"s to the "Text" field if you need a more complex key combination.

Alternatively you can use the condition builder and add each key as an "And" element.


You can find the possible key names for that token under the heading "Key State Token Parameter Values" on page 143 of VoiceAttackHelp.pdf

TwanV

  • Guest
Re: Is it possible to run VA with 2 different PTT ?
« Reply #5 on: February 21, 2018, 11:12:47 AM »
Outstanding, I was hoping for a custom command like that. Thanks for your help, works like a charm. :)

tanx66

  • Guest
Re: Is it possible to run VA with 2 different PTT ?
« Reply #6 on: October 27, 2019, 08:38:12 AM »
@Pfeil,

when you say "paste" what do you mean? I can only see where you can add commands individually - I have potentially many 10s of commands to edit and individual application is a clickfest.

Also, I don't understand how "Change the "PTTChannel" value from 1 to something else(other than 0, which is the "off" state) for your second PTT command", works as each channel has it's own key (my default is Home and End). Would it not be better to have two 'variables' one each per channel/keypress, ie. "PTTChannelUHF" and "PTTChannelVHF"?

TANX

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4591
  • RTFM
Re: Is it possible to run VA with 2 different PTT ?
« Reply #7 on: October 27, 2019, 02:04:59 PM »
when you say "paste" what do you mean?
You would create those actions in the first command you want to apply them to, then copy them (using Ctrl-C or the "Copy" option in the context menu) so you can paste them at the top of each command that requires it, without having the recreate them from scratch each time.

Also, I don't understand how "Change the "PTTChannel" value from 1 to something else(other than 0, which is the "off" state) for your second PTT command", works as each channel has it's own key (my default is Home and End). Would it not be better to have two 'variables' one each per channel/keypress, ie. "PTTChannelUHF" and "PTTChannelVHF"?

If you intend to press both push-to-talk buttons simultaneously, separate variables would become necessary (in which case you'd want to use Boolean values instead), however as the F16 (as I assumed would be used in Falcon) uses a hat switch for different radios, only one channel would be active at a time.
In that scenario, UHF could set "PTTChannel" to 1, whereas VHF could set "PTTChannel" to 2.

boxer

  • Newbie
  • *
  • Posts: 4
Re: Is it possible to run VA with 2 different PTT ?
« Reply #8 on: January 24, 2021, 05:49:15 PM »
Sorry to dredge up an old thread but this seems like the right place to ask.

I have been trying to do more or less exactly the above suggested approach for using commands to start/stop listening and then use those to gate commands that generate keys to send to the game so that some key sequences are only sent when one button is pressed and others when a second button is pressed.

Long story short, this seems to work exactly as expected if the command gated with a compare block is a simple command that does all the key sending.  However, for any sequence that I want to send using a prefix/suffix arrangement it initially didn't seem to work for me.  What I observed is that as soon as I introduce the compare block into the prefix command it seems to stop sending keys no matter what.

In other words, without the compare, I can press either joystick button and say the phrase, Voice Attack signals that the whole prefix/suffix phrase is recognized and the keys are sent.  Conversely, when I add the compare to the prefix command, now when I press either joystick button I still see that the phrase is recognized but no keys are sent regardless of which button I press.

I tried the above technique with separate booleans instead of integer compares.  Same result.  I tried with an explicit "exit command" in the compare block body instead of using the flag on the end condition.  Same result. 

Originally I had set the prefix commands up to send a key -- opens a menu.  Then the suffix commands were sending keys to select and item from the menu.  My assumption was that the exit command was best placed in the prefix...you know, avoid doing any more work from that point you know that you want to exit kind of thing.  Someone suggested that maybe the way to do this is to consolidate all the output work in the suffix and put the gate on that instead.

I tried that -- prefix command having no actions, just the phrase to say -- and then the suffix command has the tail end of the phrase to say and a set of actions to open the menu and select an item all in one go.  When I add the compare block to the suffix in this case...voila, it all works again like you'd expect...only keys are sent when you press the right button for that suffix command.

So I guess I have a workaround -- just move the key sends that are in the prefixes right now in all the relevant suffixes that can go with that prefix.  That seems less elegant however.

Is what I have observed the expected behavior or am I actually missing a trick??  I guess I'm trying to understand why gating the prefix command didn't work.  It would be great to know if there's a better way to do this before I go re-edit all the suffixes I have set up again.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4591
  • RTFM
Re: Is it possible to run VA with 2 different PTT ?
« Reply #9 on: January 24, 2021, 05:59:29 PM »
If you put
Code: [Select]
Begin Integer Compare : [PTTChannel] Does Not Equal 1
End Condition - Exit when condition met
into a prefix, and "PTTChannel" is not set to 1, the command should stop (prefix and suffix; they are combined before execution and are effectively a single command, from an execution order perspective)

However, you need to make sure the "Evaluate 'Not Set' as zero" option is checked (generally you'll always want to do that; this is regardless of prefix/suffix or full commands)

boxer

  • Newbie
  • *
  • Posts: 4
Re: Is it possible to run VA with 2 different PTT ?
« Reply #10 on: January 24, 2021, 08:35:49 PM »
Wow -- thanks for the fast reply!

I am certain that I have "evaluate 'Not Set' as zero" in these conditions checked.  Logically though that would only seem to affect the first invocation because on the first release of the button that command does set the value back to zero; well I assume so if I groked how the variable store works.

I am also fairly certain that if I put this condition in the prefix alone that keys associated with the prefix and suffix commands are never sent no matter the value of the variable.

What you propose makes good sense to me but I think it doesn't work like that in practice -- at least for me.

Further tinkering this evening I put the same condition in both the prefix and suffix commands -- seems redundant to do that, why wouldn't the condition in the prefix just stop the whole train, right?? -- and sure enough when I do that, I can have key sends from both the actions of prefix and suffix apparently work, properly gated by the condition.

All of these experiments suggest to me that the way I'm setting the variable and conditions is sound.  As a coder I get completely your point about the conjoining of the prefix and suffix into a single command and thus a condition at the beginning of this train should stop it.  What makes no sense to me yet is why having the one condition in the prefix causes the composite command never to send any keys regardless.  Am I the only one that gets that result??

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4591
  • RTFM
Re: Is it possible to run VA with 2 different PTT ?
« Reply #11 on: January 24, 2021, 08:51:32 PM »
How are your commands actually set up (or rather, how did you set them up before, when it did not appear to work)?

Right-click the action list, choose "Copy All as Text" from the context menu, then paste here into a code block (click the # button)

boxer

  • Newbie
  • *
  • Posts: 4
Re: Is it possible to run VA with 2 different PTT ?
« Reply #12 on: January 24, 2021, 09:17:08 PM »
OK -- here's what I have:
Code: [Select]
Start VoiceAttack listening
Set Boolean [UHF-PTT] to True
Start Loop While : Keyboard Key 'Scroll Lock' Is Pressed OR Joystick 1 Button 21 Is Pressed
    Pause 1 second
End Loop
Set Boolean [UHF-PTT] to False
Stop VoiceAttack listening
and
Code: [Select]
Start VoiceAttack listening
Set Boolean [VHF-PTT] to True
Start Loop While : Keyboard Key '\ |' Is Pressed OR Joystick 1 Button 20 Is Pressed
    Pause 1 second
End Loop
Set Boolean [VHF-PTT] to False
Stop VoiceAttack listening
That's the buttons.

Here's a test piece prefix command I've been using (when I say "prefix")
Code: [Select]
Begin Boolean Compare : [UHF-PTT] Equals False
    Exit Command
End Condition
Press Left Shift+Y keys and hold for 0.1 seconds and release
and here's the suffix command:
Code: [Select]
Press down Right Shift key
Pause 0.294 seconds
Press down H key
Pause 0.11 seconds
Release Right Shift key
Pause 0 seconds
Release H key
Pause 0.382 seconds
Press E key and hold for 0.073 seconds and release
Pause 0.165 seconds
Press L key and hold for 0.041 seconds and release
Pause 0.088 seconds
Press L key and hold for 0.079 seconds and release
Pause 0.095 seconds
Press O key and hold for 0.072 seconds and release
Pause 0.872 seconds
Press down Right Shift key
Pause 0.169 seconds
Press 1 key and hold for 0.129 seconds and release
Pause 0.064 seconds
Release Right Shift key
Pause 0.065 seconds
Press Enter key and hold for 0.081 seconds and release
I added a key for the PTT as well as the joystick button for testing and so that I could run the script on this machine rather than the gaming machine but the results aren't affected.  I have notepad++ as the foreground app and in there I'm expecting:
Code: [Select]
YHello!
Only when I'm pressing the scroll lock to set that boolean and not when I press the '\' but what I'm getting is nothing at all in that case(?) whichever key I press (or button I press on the other machine).

I've done something goofy here, I'm sure...just can't quite see what.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4591
  • RTFM
Re: Is it possible to run VA with 2 different PTT ?
« Reply #13 on: January 24, 2021, 09:26:21 PM »
Only when I'm pressing the scroll lock to set that boolean and not when I press the '\' but what I'm getting is nothing at all in that case(?) whichever key I press (or button I press on the other machine).
Nothing at all in which case?

On the surface the combination of the command that sets "UHF-PTT" and the prefix looks like it should work. Logically, as the other  command sets "VHF-PTT" instead, that should not stop the prefix from running, by itself.


Export the commands (or the whole profile, if you prefer), and attach it to a post here. I'll have a look at the behavior on my machine when I can.

boxer

  • Newbie
  • *
  • Posts: 4
Re: Is it possible to run VA with 2 different PTT ?
« Reply #14 on: January 25, 2021, 12:07:02 AM »
Nothing at all in which case?
I meant in the case where I have the condition check in the prefix and not the suffix, in that case I didn't get any output, no matter which PTT I pressed.

However, I say "didn't" - past tense - because after your last post there I went and made a fresh profile and copied the PTT commands and the prefix/suffix test commands into it intending to upload that.  Before I did though I tested it to make sure I didn't introduce any new or different symptoms.  I'm glad I did because in that new profile the prefix/suffix commands work just like I expected in the first place -- doh!!  There has to be something else messed up in the profile that I've been using to try and do testing on this lot I guess.  At any rate, I'm making progress again.  Thanks for your patience and support with my questions but I think working from this "clean sheet" will probably get me sorted out at this point.