Generally speaking it works. I have a few problem with some of the words, such as 'echo', 'zero' and a few others. I've tried to use Windows Speech Recognition to improve keywords, but that has had limited success. I also feel like it doesn't flow nicely, as if I have to put big pauses in between.
So I suppose I am now wondering if my command can be tidied up, improved, or made to be highly specific about what voice commands to listen to.
Having to leave pauses in between phrases is necessary, you can't really eliminate that.
With responses you can't use more than 250 different phrases, so you can't use phrases like "alpha alpha" to allow for quicker input either.
As for things like "echo" getting recognized, that should improve with training, but may be limited by your microphone(if you're using the mic in your VR headset, make sure to train a profile with that; If you have a Vive, which has a relatively poor microphone, you may want to consider an external one) or your pronunciation.
I'd be grateful for your observations on my attempt.
It's worth remembering that an "Else If" tree is a process of elimination, I.E. once a certain comparison has been made it will not be made again.
Because of this, you can structure your tree differently to use only the starting character of your NATO alphabet words:
Begin Text Compare : [a] Contains 'Zero'
Execute command, '((CDU 0 Key))'
Else If Text Compare : [a] Contains 'One'
Execute command, '((CDU 1 Key))'
Else If Text Compare : [a] Contains 'Two'
Execute command, '((CDU 2 Key))'
Else If Text Compare : [a] Contains 'Three'
Execute command, '((CDU 3 Key))'
Else If : [a] Contains 'Four' OR [a] Contains 'for'
Execute command, '((CDU 4 Key))'
Else If Text Compare : [a] Contains 'Five'
Execute command, '((CDU 5 Key))'
Else If Text Compare : [a] Contains 'Six'
Execute command, '((CDU 6 Key))'
Else If Text Compare : [a] Contains 'Seven'
Execute command, '((CDU 7 Key))'
Else If Text Compare : [a] Contains 'Eight'
Execute command, '((CDU 8 Key))'
Else If Text Compare : [a] Contains 'Nine'
Execute command, '((CDU 9 Key))'
Else If Text Compare : [a] Contains 'Delete'
Execute command, '((CDU CLR Key))'
Else If Text Compare : [a] Contains 'Backspace'
Execute command, '((CDU BCK Key))'
Else If Text Compare : [a] Starts With 'A'
Execute command, '((CDU A Key))'
Else If Text Compare : [a] Starts With 'B'
Execute command, '((CDU B Key))'
Else If Text Compare : [a] Starts With 'C'
Execute command, '((CDU C Key))'
Else If Text Compare : [a] Starts With 'D'
Execute command, '((CDU D Key))'
Else If Text Compare : [a] Starts With 'E'
Execute command, '((CDU E Key))'
Else If Text Compare : [a] Starts With 'F'
Execute command, '((CDU F Key))'
Else If Text Compare : [a] Starts With 'G'
Execute command, '((CDU G Key))'
Else If Text Compare : [a] Starts With 'H'
Execute command, '((CDU H Key))'
Else If Text Compare : [a] Starts With 'I'
Execute command, '((CDU I Key))'
Else If Text Compare : [a] Starts With 'J'
Execute command, '((CDU J Key))'
Else If Text Compare : [a] Starts With 'K'
Execute command, '((CDU K Key))'
Else If Text Compare : [a] Starts With 'L'
Execute command, '((CDU L Key))'
Else If Text Compare : [a] Starts With 'M'
Execute command, '((CDU M Key))'
Else If Text Compare : [a] Starts With 'N'
Execute command, '((CDU N Key))'
Else If Text Compare : [a] Starts With 'O'
Execute command, '((CDU O Key))'
Else If Text Compare : [a] Starts With 'P'
Execute command, '((CDU P Key))'
Else If Text Compare : [a] Starts With 'Q'
Execute command, '((CDU Q Key))'
Else If Text Compare : [a] Starts With 'R'
Execute command, '((CDU R Key))'
Else If Text Compare : [a] Starts With 'S'
Execute command, '((CDU S Key))'
Else If Text Compare : [a] Starts With 'T'
Execute command, '((CDU T Key))'
Else If Text Compare : [a] Starts With 'U'
Execute command, '((CDU U Key))'
Else If Text Compare : [a] Starts With 'V'
Execute command, '((CDU V Key))'
Else If Text Compare : [a] Starts With 'W'
Execute command, '((CDU W Key))'
Else If Text Compare : [a] Starts With 'X'
Execute command, '((CDU X Key))'
Else If Text Compare : [a] Starts With 'Y'
Execute command, '((CDU Y Key))'
Else If Text Compare : [a] Starts With 'Z'
Execute command, '((CDU Z Key))'
End Condition
Alternatively, you could combine this with my earlier example:
Begin Text Compare : [a] Contains 'Zero'
Execute command, '((CDU 0 Key))'
Else If Text Compare : [a] Contains 'One'
Execute command, '((CDU 1 Key))'
Else If Text Compare : [a] Contains 'Two'
Execute command, '((CDU 2 Key))'
Else If Text Compare : [a] Contains 'Three'
Execute command, '((CDU 3 Key))'
Else If : [a] Contains 'Four' OR [a] Contains 'for'
Execute command, '((CDU 4 Key))'
Else If Text Compare : [a] Contains 'Five'
Execute command, '((CDU 5 Key))'
Else If Text Compare : [a] Contains 'Six'
Execute command, '((CDU 6 Key))'
Else If Text Compare : [a] Contains 'Seven'
Execute command, '((CDU 7 Key))'
Else If Text Compare : [a] Contains 'Eight'
Execute command, '((CDU 8 Key))'
Else If Text Compare : [a] Contains 'Nine'
Execute command, '((CDU 9 Key))'
Else If Text Compare : [a] Contains 'Delete'
Execute command, '((CDU CLR Key))'
Else If Text Compare : [a] Contains 'Backspace'
Execute command, '((CDU BCK Key))'
Else
Execute command, '((CDU {TXTSUBSTR:a:0:1} Key))' (by name)
End Condition
If you use actual numbers(either "0;1;2;3;4;5;6;7;8;9", or the shorthand "[0..9]"), you can reduce it further to
Begin Text Compare : [a] Contains 'Delete'
Execute command, '((CDU CLR Key))'
Else If Text Compare : [a] Contains 'Backspace'
Execute command, '((CDU BCK Key))'
Else
Execute command, '((CDU {TXTSUBSTR:a:0:1} Key))' (by name)
End Condition
As a side note, you may notice the response variable I used was named "~response". The tilde("~") prefix signifies that this is a command-scoped variable, meaning it's discarded after the command stops.
Unless you plan to use the contents of a variable in more than one command, and they're not in the same execution chain, it's good practice to use a more limited scope.
One major benefit(though less relevant in this particular case), is that you can have multiple instances of the same command, or even multiple different commands, use the same variable name, and because it's scoped to that command or execution chain only, they won't interfere with each other.
See the "Advanced Variable Control (Scope)" chapter on page 173 of VoiceAttackHelp.pdf for more information.