Author Topic: Help setting Dictation Limitations  (Read 1752 times)

Sannosuke

  • Newbie
  • *
  • Posts: 5
Help setting Dictation Limitations
« on: April 01, 2023, 11:26:13 PM »
I am working on a Voice Command for Elite Dangerous to automatically Set Route to a system on the Galaxy Map.
I started off with "Wait for Spoken Response" and listed by hand every single system starting with LP (Well over 100).  The accuracy and effect was phenomenal, but there are literally billions of systems, and it is unfeasible to list the countless systems by hand.

The clear option is to use Dictation.

I now have the code working with Dictation, however the accuracy is abysmal.  Nearly every System is a string of Letters and Numbers with the occasional -.  Letters like 'L' are almost almost interpreted as "help," 'E' as 'me,' - becomes "dash/cash" and so on.  I've set the Recognition Prefix Exclusions to include "zero, one... nine" & "help, cash, dash" etc, but they still show up far too often, probably because they are not in the Prefix.

I desperately need a way to force Dictation to only Input Letters, Numbers, and Dashes as it's possible input.
Is there any way this is possible?

Thanks so much for any help or thoughts you can share~ <3

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Help setting Dictation Limitations
« Reply #1 on: April 02, 2023, 10:25:31 AM »
The dictation feature cannot be configured in the manner you are describing, no.

Arbitrary input is not a simple problem to solve.


Listing every possible system would not be technically feasible (the action accepts a maximum of 500 possible responses at a time, but even if there was no such limitation, billions of predefined inputs is not something the speech recognition system is designed for).

However, the "Wait For Spoken Response" action could be used to dictate character-by-character, possibly using the NATO alphabet ("alpha", "bravo", "charlie", etc...) for better accuracy.
The main downside to this would be the need to wait for recognition between each character.

Sannosuke

  • Newbie
  • *
  • Posts: 5
Re: Help setting Dictation Limitations
« Reply #2 on: April 03, 2023, 11:09:34 AM »
You are an absolute treasure, Pfeil!
Honestly, I had been reading through dozens of your replies throughout the years on various questions, and had a secret hope that you would be so kind as to respond to me as well when I posted ^_^
I truly appreciate your swift and insightful response, and thank you sincerely!

I had a lot of trouble getting the NATO alphabet to function, but guiding me back to use the "Wait for Spoken Response" command now has things running fairly smoothly.

I'm certain the code is amateur and janky, and I was hoping you're genius might help me finish up the last 5ish% of this project.

There's some strange nuances that are occurring with missing letters in several of the entries.  Most are working fine, but "Andromedae" always types "ndromeda" or "anromedea," "Fong Wang" always types "Fong Wng," "Indi" always types "Ndi," "Canis" always types "Cnis," and "Dahan" always types "Dahn."  It seems to struggle inputting an 'A' specifically in most of the examples.  Most other inputs work completely fine, (although 'A' is frustratingly often interpreted as '8'), and I've gone into "Add/Remove Dictionary Words" to force feed the Voice Recognition some of the whacky ones (and not so whacky ones too, like the difference between A and 8!).  Even "Wredguia" is working perfectly.  For a while it really didn't like repeating letters (example "Ross" would type "Ros", and "Gamma" would type "Gama"), but this seems to be working now for some reason.  I've also tried setting my Command Weight to 100 hoping to force it to take something from the list, but it didn't make any discernable difference from the default Command Weight.

PS. I'm pretty sure my "Set text [System_Input] to [System_Input] (Replace 'x' with 'y')" lines are all doing a whole lot of nothing, but I've left them in there because it's working about 95% the way I'd like.  Also, the \\notations\\ are not in the actual code.

Here's the code:

Code: [Select]
\\Trigger words\\
When I say: [lay in a; plot a; plot us a; set; set a;set up a;set us up a; set in a; plan; plan a; plan us a; prepare; prepare a] [new;] [system;] [destination; path; route; course] [please;]

\\Play Random Voice Line\\
Set small int (condition) [Plot_Course_Response] value as random from 1 to 2
Begin Small Integer Compare : [Plot_Course_Response] Equals 1
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Acknowledgements\Understood.mp3'
End Condition
Begin Small Integer Compare : [Plot_Course_Response] Equals 2
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Acknowledgements\Preparing now.mp3'
End Condition

\\Open the Galaxy Map and Click in the Search Bar\\
Pause 0.1 seconds
Press . > key and hold for 0.1 seconds and release
Pause 3 seconds
Move mouse cursor to screen coordinates (707, 128)
Pause 0.1 seconds
Click left mouse button
Play sound, '{VA_SOUNDS}\hcspack-CARINA\Crew Commands\Ready and waiting.mp3'

\\Beginning of Voice Input Loop (A BAD loop made with Markers X,D).  Continues until [System_Input] = done, finished, or go\\
Pause 0.1 seconds
Marker: Still Speaking
Set text [System_Input] to 'Null'
Wait for spoken response: 'a; b; beat; c; see; sea; seat; d; e; f; g; sheet; h; i; j; k; l; m; n; and; ; an; in; o; all; p; q; r; are; s; t; u; you; v; w; x; y; z; zero; one; two; three; four; five; six; seven; eight; nine; 0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20; 21; 22; 23; 24; 25; 26; 27; 28; 29; 30; 31; 32; 33; 34; 35; 36 ; 37; 38; 39; 40; 41; 42; 43; 44; 45; 46; 47; 48; 49; 50; 51; 52; 53; 54; 55; 56; 57; 58; 59; 60; 61; 62; 63; 64; 65; 66; 67; 68; 69; 70; 71; 71; 73; 74; 75; 76; 77; 78; 79; 80; 81; 82; 83; 84; 85; 86; 87; 88; 89; 90; 91; 92; 93; 94; 95; 96; 97; 98; 99; -; Alcor; Alioth; Alpha Centauri; Altair; andromedea; Arque; Asellus; Asellus Primus; Asterope; Barnard's Star; Borann; Bunda; Canis; centauri; Ceos; Chakpa; Colonia; Dahan; dark; Deciat; Delphi; Dezhra; Doris; Draconis; Epsilon; Epsilon indi; Eurybia; Fong Wang; Fujin; Gama; Gamma; Gateway; Hera; Horsehead; Hyades; Indi; Jackson's Lighthouse; Jeng; Kamitra; Khun; Kuwemaki; Kuk; Laksak; lave; leesti; lembava; LHS; LP; luyten's star; maia; mainani; majoris; merope; mizar; muang; Nebula; Nuenets; Ogmar; Ori; Orion; Parutis; Primus; Procyon; Ragnorak; Rackham's Peak; Rhea; Robigo; Ross; Sagittarius; Sector; Shinrarta Dezhra; Shinrarata; Sigma; Sirius; Sothis; Taygeta; Theta; Ursae; Wredguia; Wolf; Wyrd; Yanyan; Yoru; space; delete; back; finished; done; go; restart; reset; start over'

\\Appropriate UI mouse clicks and "backspace" key to clear the Input Field\\
Begin Text Compare : [System_Input] Equals 'restart'
    Move mouse cursor to screen coordinates (707, 95)
    Pause 0.1 seconds
    Click left mouse button
    Move mouse cursor to screen coordinates (707, 128)
    Pause 0.1 seconds
    Click left mouse button
    Pause 0.1 seconds
    Press Back key and hold for 0.1 seconds and release
    Jump to Marker: Still Speaking
End Condition
Begin Text Compare : [System_Input] Equals 'reset'
    Move mouse cursor to screen coordinates (707, 95)
    Pause 0.1 seconds
    Click left mouse button
    Move mouse cursor to screen coordinates (707, 128)
    Pause 0.1 seconds
    Click left mouse button
    Pause 0.1 seconds
    Press Back key and hold for 0.1 seconds and release
    Jump to Marker: Still Speaking
End Condition
Begin Text Compare : [System_Input] Equals 'start over'
    Move mouse cursor to screen coordinates (707, 95)
    Pause 0.1 seconds
    Click left mouse button
    Move mouse cursor to screen coordinates (707, 128)
    Pause 0.1 seconds
    Click left mouse button
    Pause 0.1 seconds
    Press Back key and hold for 0.1 seconds and release
    Jump to Marker: Still Speaking
End Condition

\\Checking for nuanced input commands to navigate the Search Field: delete, back\\
Begin Text Compare : [System_Input] Equals 'delete'
    Press Back key and hold for 0.1 seconds and release
    Jump to Marker: Still Speaking
End Condition
Begin Text Compare : [System_Input] Equals 'back'
    Press Left key and hold for 0.1 seconds and release
    Jump to Marker: Still Speaking
End Condition

\\Checking for nuanced input to designate the user is done inputting\\
Begin Text Compare : [System_Input] Equals 'finished'
    Jump to Marker: Finished
End Condition
Begin Text Compare : [System_Input] Equals 'done'
    Jump to Marker: Finished
End Condition
Begin Text Compare : [System_Input] Equals 'go'
    Jump to Marker: Finished
End Condition

\\A bunch of probably useless crap to try to make it more accurate\\
Set text [System_Input] to [System_Input] (Replace 'zero' with '0')
Set text [System_Input] to [System_Input] (Replace 'one' with '1')
Set text [System_Input] to [System_Input] (Replace 'two' with '2')
Set text [System_Input] to [System_Input] (Replace 'three' with '3')
Set text [System_Input] to [System_Input] (Replace 'four' with '4')
Set text [System_Input] to [System_Input] (Replace 'five' with '5')
Set small int (condition) [Plot_Course_Response] value as random from 1 to 2
Begin Small Integer Compare : [Plot_Course_Response] Equals 1
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Acknowledgements\Understood.mp3'
End Condition
Begin Small Integer Compare : [Plot_Course_Response] Equals 2
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Acknowledgements\Preparing now.mp3'
End Condition
Pause 0.1 seconds
Press . > key and hold for 0.1 seconds and release
Pause 3 seconds
Move mouse cursor to screen coordinates (707, 128)
Pause 0.1 seconds
Click left mouse button
Play sound, '{VA_SOUNDS}\hcspack-CARINA\Crew Commands\Ready and waiting.mp3'
Pause 0.1 seconds
Marker: Still Speaking
Set text [System_Input] to 'Null'
Wait for spoken response: 'a; b; beat; c; see; sea; seat; d; e; f; g; sheet; h; i; j; k; l; m; n; and; ; an; in; o; all; p; q; r; are; s; t; u; you; v; w; x; y; z; zero; one; two; three; four; five; ...'
Begin Text Compare : [System_Input] Equals 'restart'
    Move mouse cursor to screen coordinates (707, 95)
    Pause 0.1 seconds
    Click left mouse button
    Move mouse cursor to screen coordinates (707, 128)
    Pause 0.1 seconds
    Click left mouse button
    Pause 0.1 seconds
    Press Back key and hold for 0.1 seconds and release
    Jump to Marker: Still Speaking
End Condition
Begin Text Compare : [System_Input] Equals 'reset'
    Move mouse cursor to screen coordinates (707, 95)
    Pause 0.1 seconds
    Click left mouse button
    Move mouse cursor to screen coordinates (707, 128)
    Pause 0.1 seconds
    Click left mouse button
    Pause 0.1 seconds
    Press Back key and hold for 0.1 seconds and release
    Jump to Marker: Still Speaking
End Condition
Begin Text Compare : [System_Input] Equals 'start over'
    Move mouse cursor to screen coordinates (707, 95)
    Pause 0.1 seconds
    Click left mouse button
    Move mouse cursor to screen coordinates (707, 128)
    Pause 0.1 seconds
    Click left mouse button
    Pause 0.1 seconds
    Press Back key and hold for 0.1 seconds and release
    Jump to Marker: Still Speaking
End Condition
Begin Text Compare : [System_Input] Equals 'delete'
    Press Back key and hold for 0.1 seconds and release
    Jump to Marker: Still Speaking
End Condition
Begin Text Compare : [System_Input] Equals 'back'
    Press Left key and hold for 0.1 seconds and release
    Jump to Marker: Still Speaking
End Condition
Begin Text Compare : [System_Input] Equals 'finished'
    Jump to Marker: Finished
End Condition
Begin Text Compare : [System_Input] Equals 'done'
    Jump to Marker: Finished
End Condition
Begin Text Compare : [System_Input] Equals 'go'
    Jump to Marker: Finished
End Condition
Set text [System_Input] to [System_Input] (Replace 'zero' with '0')
Set text [System_Input] to [System_Input] (Replace 'one' with '1')
Set text [System_Input] to [System_Input] (Replace 'two' with '2')
Set text [System_Input] to [System_Input] (Replace 'three' with '3')
Set text [System_Input] to [System_Input] (Replace 'four' with '4')
Set text [System_Input] to [System_Input] (Replace 'five' with '5')
Set text [System_Input] to [System_Input] (Replace 'six' with '6')
Set text [System_Input] to [System_Input] (Replace 'seven' with '7')
Set text [System_Input] to [System_Input] (Replace 'eight' with '8')
Set text [System_Input] to [System_Input] (Replace 'nine' with '9')
Set text [System_Input] to [System_Input] (Replace 'beat' with 'B')
Set text [System_Input] to [System_Input] (Replace 'see' with 'C')
Set text [System_Input] to [System_Input] (Replace 'sea' with 'C')
Set text [System_Input] to [System_Input] (Replace 'seat' with 'C')
Set text [System_Input] to [System_Input] (Replace 'sheet' with 'G')
Set text [System_Input] to [System_Input] (Replace 'and' with 'N')
Set text [System_Input] to [System_Input] (Replace 'in' with 'N')
Set text [System_Input] to [System_Input] (Replace 'an' with 'N')
Set text [System_Input] to [System_Input] (Replace 'all' with 'O')
Set text [System_Input] to [System_Input] (Replace 'are' with 'R')
Set text [System_Input] to [System_Input] (Replace 'you' with 'U')
Set text [System_Input] to [System_Input] (Replace 'are' with 'R')
Set text [System_Input] to [System_Input] (Replace 'La. chess' with 'LHS ')
Set text [System_Input] to [System_Input] (Replace 'NDI' with 'Indi')
Set text [System_Input] to [System_Input] (Replace 'space' with ' ')
Pause 1 second
Press variable key(s) [System_Input] and hold for 0.2 seconds and release
Jump to Marker: Still Speaking
Marker: Finished
Move mouse cursor to screen coordinates (703, 157)
Pause 0.1 seconds
Click left mouse button
Pause 0.1 seconds
Play sound, '{VA_SOUNDS}\hcspack-CARINA\Profile sounds\ED\Course Headings\((RS - CH setting course))\Verbose\Locking target and setting course.mp3'  (and wait until it completes)
Pause 2 seconds
Move mouse cursor to screen coordinates (1822, 603)
Pause 0.1 seconds
Click left mouse button
Pause 0.1 seconds
Play sound, '{VA_SOUNDS}\hcspack-CARINA\Targeting\Course locked 2.mp3'
Pause 2 seconds
Move mouse cursor to screen coordinates (99, 1007)
Click left mouse button
Set text [System_Input] to [System_Input] (Replace 'six' with '6')
Set text [System_Input] to [System_Input] (Replace 'seven' with '7')
Set text [System_Input] to [System_Input] (Replace 'eight' with '8')
Set text [System_Input] to [System_Input] (Replace 'nine' with '9')
Set text [System_Input] to [System_Input] (Replace 'beat' with 'B')
Set text [System_Input] to [System_Input] (Replace 'see' with 'C')
Set text [System_Input] to [System_Input] (Replace 'sea' with 'C')
Set text [System_Input] to [System_Input] (Replace 'seat' with 'C')
Set text [System_Input] to [System_Input] (Replace 'sheet' with 'G')
Set text [System_Input] to [System_Input] (Replace 'and' with 'N')
Set text [System_Input] to [System_Input] (Replace 'in' with 'N')
Set text [System_Input] to [System_Input] (Replace 'an' with 'N')
Set text [System_Input] to [System_Input] (Replace 'all' with 'O')
Set text [System_Input] to [System_Input] (Replace 'are' with 'R')
Set text [System_Input] to [System_Input] (Replace 'you' with 'U')
Set text [System_Input] to [System_Input] (Replace 'are' with 'R')
Set text [System_Input] to [System_Input] (Replace 'La. chess' with 'LHS ')
Set text [System_Input] to [System_Input] (Replace 'NDI' with 'Indi')
Set text [System_Input] to [System_Input] (Replace 'space' with ' ')
Pause 1 second

\\Input was valid, type it into the field, return to Marker and await further input\\
Press variable key(s) [System_Input] and hold for 0.2 seconds and release
Jump to Marker: Still Speaking

\\Once "System_Input" = finished, done, go, move to this place.  UI mouse movements to navigate to the proper input and lock in the travel route\\
Marker: Finished
Move mouse cursor to screen coordinates (703, 157)
Pause 0.1 seconds
Click left mouse button
Pause 0.1 seconds
Play sound, '{VA_SOUNDS}\hcspack-CARINA\Profile sounds\ED\Course Headings\((RS - CH setting course))\Verbose\Locking target and setting course.mp3'  (and wait until it completes)
Pause 2 seconds
Move mouse cursor to screen coordinates (1822, 603)
Pause 0.1 seconds
Click left mouse button
Pause 0.1 seconds
Play sound, '{VA_SOUNDS}\hcspack-CARINA\Targeting\Course locked 2.mp3'
Pause 2 seconds
\\Exit the Map\\
Move mouse cursor to screen coordinates (99, 1007)
Click left mouse button

Any wisdom or light you can shine on the situation?
I've seen some of your other responses doing Else/If statements to check and type every letter, which I'm sure solves some, if not all, of the missing repeated letters, but it seemed over my head when trying to apply it to this.

I'm also not sure if there's a way to automatically add a space to the end of inputs such as Wolf; LHS; LP; etc.  I've tried putting Wolf ' '; LHS ' ': LP ' '; etc, but to no avail.

Oh, also I didn't originally have things like "see, sea, she" as options in the "Wait for spoken response" field, and not entirely sure it's necessary, but it just kept registering those words when I was trying certain Letter Input, so I put them in and tried to convert them into to the proper response.
« Last Edit: April 03, 2023, 12:55:40 PM by Sannosuke »

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Help setting Dictation Limitations
« Reply #3 on: April 03, 2023, 11:38:17 AM »
Variable keypresses are intended for a single combination of keys that are pressed simultaneously, not a sequence of keys that are pressed and released.

E.G. passing "Dahan" to a keypress action is roughly the equivalent of
Code: [Select]
Press down D key
Press down A key
Press down H key
Press N key and hold for 0,05 seconds and release
Release A key
Release H key
Release D key

If you want to type multiple characters, that's what the "Quick Input" action is intended for (note that this action will also attempt to use any necessary modifiers, E.G. the Shift key to produce capital letters).



While it wouldn't change the functionality of the command, I would recommend looking into the condition builder, to consolidate different checks that result in an identical sequence of actions being executed.

E.G.
Code: [Select]
Begin Text Compare : [System_Input] Equals 'finished'
    Jump to Marker: Finished
End Condition
Begin Text Compare : [System_Input] Equals 'done'
    Jump to Marker: Finished
End Condition
Begin Text Compare : [System_Input] Equals 'go'
    Jump to Marker: Finished
End Condition
could instead be
Code: [Select]
Begin Condition : [System_Input] Equals 'finished' OR [System_Input] Equals 'done' OR [System_Input] Equals 'go'
    Jump to Marker: Finished
End Condition


I'll also point out that, like the "When I say" field, the "Wait For Spoken Response" action accepts dynamic command sections, including numeric ranges.
So instead of explicitly specifying every number from 0 to 99, you could use
Code: [Select]
[0..99]

Replacing input can work, though you have a sequence of replacements where one will always take precedence and prevent the next from working:
Code: [Select]
Set text [System_Input] to [System_Input] (Replace 'sea' with 'C')
Set text [System_Input] to [System_Input] (Replace 'seat' with 'C')
This would result in "Ct" if the input is "seat".

You also have
Code: [Select]
Set text [System_Input] to [System_Input] (Replace 'are' with 'R')twice, though that in itself won't make a difference.

Sannosuke

  • Newbie
  • *
  • Posts: 5
Re: Help setting Dictation Limitations
« Reply #4 on: April 03, 2023, 12:57:39 PM »
Thank you so so much, Pfeil.
This makes so much sense.

I can't believe the amount of time and effort you pour into the community here, and into me.
Thank you~

And I can't believe you figured out where that dang "CT" was coming from whenever I said 'C'!  You're a genius O_O  I never would have figured that out!

I'll dive into your ideas here today and appreciate you so very much. ^~^

Sannosuke

  • Newbie
  • *
  • Posts: 5
Re: Help setting Dictation Limitations
« Reply #5 on: April 03, 2023, 08:42:56 PM »
Man, this is SO much cleaner and easier to read!

Thank you again guiding me in ways to consolidate the code.  It's making a huge difference.

I've tried switching from "Get User Input > Spoken Response" to instead using "Quick Input" with {TXT:System_Input} in the field to try to solve the missing keystrokes, but it still seems to be doing it.  What I'm noticing in the log feed is it has something to do with an N coming after an A.  "fong wang" is reporting "fong wNg" in the log, "dahan" is "dahN," "canis" is "cNis," "yanyan" is "yNyN" etc.

Here's the rewrite and updated version of the code (and found the "comment" feature to clean up the layout!")

Code: [Select]
Randomly play 1 of 5 "Acknowledged" Sound Responses
Set small int (condition) [Plot_Course_Response] value as random from 1 to 5
Begin Small Integer Compare : [Plot_Course_Response] Equals 1
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Acknowledgements\Understood.mp3'
End Condition
Begin Small Integer Compare : [Plot_Course_Response] Equals 2
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Acknowledgements\Preparing now.mp3'
End Condition
Begin Small Integer Compare : [Plot_Course_Response] Equals 3
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Acknowledgements\Affirmative.mp3'
End Condition
Begin Small Integer Compare : [Plot_Course_Response] Equals 4
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Acknowledgements\As you wish 2.mp3'
End Condition
Begin Small Integer Compare : [Plot_Course_Response] Equals 5
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Acknowledgements\Roger that.mp3'
End Condition

Open the Galaxy Map and Click on the Navigation Bar
Pause 0.1 seconds
Press . > key and hold for 0.1 seconds and release
Pause 3 seconds
Move mouse cursor to screen coordinates (707, 128)
Pause 0.1 seconds
Click left mouse button

Randomly play 1 of 6 "Awaiting Input" Sound Responses
Set small int (condition) [Awaiting_Input] value as random from 1 to 6
Begin Small Integer Compare : [Awaiting_Input] Equals 1
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Crew Commands\Ready and waiting.mp3'
End Condition
Begin Small Integer Compare : [Awaiting_Input] Equals 2
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Profile sounds\Generic\Ship Functions\((RS - Awaiting Orders Captain))\non-verbose\Awaiting orders 2.mp3'
End Condition
Begin Small Integer Compare : [Awaiting_Input] Equals 3
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Profile sounds\Generic\Ship Functions\((RS - Awaiting Orders Captain))\Verbose\Captain what are your orders.mp3'
End Condition
Begin Small Integer Compare : [Awaiting_Input] Equals 4
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Profile sounds\ED\Course Headings\((RS - CH Confirm))\non-verbose\Please select your destination.mp3'
End Condition
Begin Small Integer Compare : [Awaiting_Input] Equals 5
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Profile sounds\ED\Course Headings\((RS - CH Confirm))\Verbose\Please select your next destination.mp3'
End Condition
Begin Small Integer Compare : [Awaiting_Input] Equals 6
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Profile sounds\ED\Course Headings\((RS - CH Confirm))\Verbose\Select your destination please.mp3'
End Condition
Pause 0.1 seconds

Get User Spoken Input.  Loop until Spoken_Input = finished; done; go
Marker: Still Speaking
Set text [System_Input] to 'Null'
Wait for spoken response: 'a; b; c; d; e; f; g; h; i; j; k; l; m; n; o; p; q; r; s; t; u; v; w; x; y; z; zero; one; two; three; four; five; six; seven; eight; nine; [0..99]; 100; 1000; 10000; -; Aitv...'

Cancel Search and Leave Galaxy Map
Begin Text Compare : [System_Input] Equals 'cancel'
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Profile sounds\Generic\Comms\((RS - Cancel message))\non-verbose\Cancelled.mp3'
    Move mouse cursor to screen coordinates (99, 1007)
    Click left mouse button
    Stop VoiceAttack command processing
End Condition

Reset the Search Field if the User Inputs a reset command
Begin Condition : [System_Input] Equals 'clear' OR [System_Input] Equals 'start over' OR [System_Input] Equals 'restart' OR [System_Input] Equals 'reset'
    Move mouse cursor to screen coordinates (707, 95)
    Pause 0.1 seconds
    Click left mouse button
    Move mouse cursor to screen coordinates (707, 128)
    Pause 0.1 seconds
    Click left mouse button
    Pause 0.1 seconds
    Press Back key and hold for 0.1 seconds and release
    Jump to Marker: Still Speaking
End Condition

Delete the previous letter.
Begin Text Compare : [System_Input] Equals 'delete'
    Press Back key and hold for 0.1 seconds and release
    Jump to Marker: Still Speaking
End Condition

Go back one letter.
Begin Text Compare : [System_Input] Equals 'back'
    Press Left key and hold for 0.1 seconds and release
    Jump to Marker: Still Speaking
End Condition

Command was "finished/done/go".  Jump to Marker to start locking in the Route.
Begin Condition : [System_Input] Equals 'finished' OR [System_Input] Equals 'done' OR [System_Input] Equals 'go'
    Jump to Marker: Finished
End Condition

Correct troublesome inputs
Set text [System_Input] to [System_Input] (Replace 'zero' with '0')
Set text [System_Input] to [System_Input] (Replace 'one' with '1')
Set text [System_Input] to [System_Input] (Replace 'two' with '2')
Set text [System_Input] to [System_Input] (Replace 'three' with '3')
Set text [System_Input] to [System_Input] (Replace 'four' with '4')
Set text [System_Input] to [System_Input] (Replace 'five' with '5')
Set text [System_Input] to [System_Input] (Replace 'six' with '6')
Set text [System_Input] to [System_Input] (Replace 'seven' with '7')
Set text [System_Input] to [System_Input] (Replace 'eight' with '8')
Set text [System_Input] to [System_Input] (Replace 'nine' with '9')
Set text [System_Input] to [System_Input] (Replace 'beat' with 'B')
Set text [System_Input] to [System_Input] (Replace 'see' with 'C')
Set text [System_Input] to [System_Input] (Replace 'sheet' with 'G')
Set text [System_Input] to [System_Input] (Replace 'an' with 'N')
Set text [System_Input] to [System_Input] (Replace 'all' with 'O')
Set text [System_Input] to [System_Input] (Replace 'are' with 'R')
Set text [System_Input] to [System_Input] (Replace 'you' with 'U')
Set text [System_Input] to [System_Input] (Replace 'space' with ' ')
Set text [System_Input] to [System_Input] (Replace 'dash' with '-')
Pause 1 second

Type the current System_Input into the Search Bar
Quick Input, '{TXT:System_Input}'
Additional Log Write to try to Troubleshoot
Write [Blue] '{TXT:System_Input}' to log
Jump to Marker: Still Speaking

Marker for finished Inputing
Marker: Finished

Click on the top listed search result to begin Plotting Route
Move mouse cursor to screen coordinates (703, 157)
Pause 0.1 seconds
Click left mouse button
Pause 0.1 seconds

Randomly play 1 of 3 "Selecting Destination" Sound Response
Set small int (condition) [Selecting_Destination] value as random from 1 to 3
Begin Small Integer Compare : [Selecting_Destination] Equals 1
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Profile sounds\ED\Course Headings\((RS - CH setting course))\Verbose\Locking target and setting course.mp3'  (and wait until it completes)
End Condition
Begin Small Integer Compare : [Selecting_Destination] Equals 2
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Profile sounds\Generic\Ship Functions\((RS - System Route))\non-verbose\Locking next star system.mp3'  (and wait until it completes)
End Condition
Begin Small Integer Compare : [Selecting_Destination] Equals 3
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Profile sounds\Generic\Ship Functions\((RS - System Route))\non-verbose\Locking system destination.mp3'  (and wait until it completes)
End Condition
Pause 2 seconds

Click on the "Plot Route" button on the right side of the UI
Move mouse cursor to screen coordinates (1822, 603)
Pause 0.1 seconds
Click left mouse button
Pause 0.1 seconds

Randomly play 1 of 2 "Destination Locked" Sound Response
Set small int (condition) [Destination_Locked] value as random from 1 to 2
Begin Small Integer Compare : [Destination_Locked] Equals 1
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Targeting\Course locked 2.mp3'
End Condition
Begin Small Integer Compare : [Destination_Locked] Equals 2
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Profile sounds\Generic\Ship Functions\((RS - System Route))\non-verbose\System destination locked.mp3'
End Condition
Pause 2 seconds

Exit the Galaxy Map
Move mouse cursor to screen coordinates (99, 1007)
Click left mouse button
« Last Edit: April 03, 2023, 09:36:53 PM by Sannosuke »

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Help setting Dictation Limitations
« Reply #6 on: April 03, 2023, 10:37:21 PM »
That would be this:
Code: [Select]
Set text [System_Input] to [System_Input] (Replace 'an' with 'N')


As an aside, a structure like
Code: [Select]
Set small int (condition) [Selecting_Destination] value as random from 1 to 3
Begin Small Integer Compare : [Selecting_Destination] Equals 1
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Profile sounds\ED\Course Headings\((RS - CH setting course))\Verbose\Locking target and setting course.mp3'  (and wait until it completes)
End Condition
Begin Small Integer Compare : [Selecting_Destination] Equals 2
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Profile sounds\Generic\Ship Functions\((RS - System Route))\non-verbose\Locking next star system.mp3'  (and wait until it completes)
End Condition
Begin Small Integer Compare : [Selecting_Destination] Equals 3
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Profile sounds\Generic\Ship Functions\((RS - System Route))\non-verbose\Locking system destination.mp3'  (and wait until it completes)
End Condition
could be simplified.

If it you're using the value of "Selecting_Destination" somewhere outside of this structure (I.E. the value needs to exist for something else to work), the main potential change would be to use the "Add Else If to Conditional Block" action:
Code: [Select]
Set small int (condition) [Selecting_Destination] value as random from 1 to 3
Begin Small Integer Compare : [Selecting_Destination] Equals 1
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Profile sounds\ED\Course Headings\((RS - CH setting course))\Verbose\Locking target and setting course.mp3'  (and wait until it completes)
Else If Small Integer Compare : [Selecting_Destination] Equals 2
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Profile sounds\Generic\Ship Functions\((RS - System Route))\non-verbose\Locking next star system.mp3'  (and wait until it completes)
Else If Small Integer Compare : [Selecting_Destination] Equals 3
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Profile sounds\Generic\Ship Functions\((RS - System Route))\non-verbose\Locking system destination.mp3'  (and wait until it completes)
End Condition
The main advantage in real terms is saving space.
Using the "Add Else If to Conditional Block" action does also allow the condition to short-circuit, meaning that if, for example, the value of "Selecting_Destination" equals 1, neither of the other conditions will be evaluated. This technically uses fewer CPU cycles, but in real-world terms that's not something you'd actually notice.


You could also do away with the final check and use the "Condition Else" action, as with this structure, if the value isn't 1 or 2, it must logically be 3, so it could be
Code: [Select]
Set small int (condition) [Selecting_Destination] value as random from 1 to 3
Begin Small Integer Compare : [Selecting_Destination] Equals 1
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Profile sounds\ED\Course Headings\((RS - CH setting course))\Verbose\Locking target and setting course.mp3'  (and wait until it completes)
Else If Small Integer Compare : [Selecting_Destination] Equals 2
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Profile sounds\Generic\Ship Functions\((RS - System Route))\non-verbose\Locking next star system.mp3'  (and wait until it completes)
Else
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Profile sounds\Generic\Ship Functions\((RS - System Route))\non-verbose\Locking system destination.mp3'  (and wait until it completes)
End Condition

Either one works, and the additional check doesn't make any real-world difference, so use whichever is clearer to you.


If, on the other hand, you don't have a need for the value of "Selecting_Destination" elsewhere, you could instead consider using the "Play a Random Sound" action, which has a "Play a random sound from a selection list", as well as a "Play a random sound from a directory" option, rather than having to manually randomize.



I will also mention that the Small Integer (Condition) datatype is considered deprecated, and generally the normal Integer datatype is preferred.
Small Integer (Condition) only remains in existence for backward-compatibility. At first, it was the only datatype (thus "(Condition)", as that's what it was previously named), otherwise it would not even need to exist as it offers no real advantages in this context.

Sannosuke

  • Newbie
  • *
  • Posts: 5
Re: Help setting Dictation Limitations
« Reply #7 on: April 04, 2023, 01:07:28 AM »
Thank you, thank you, thank you!
I can't begin to say how much I appreciate, and how much I have learned from you!
This is truly invaluable, and I can't believe how much you've poured into me, friend.
Thank you, Pfeil!
Everything is working exactly as I had hoped!  Even added a little segment to test if it's an Input that needs a "space" afterwards using your Add Else/If to Condition Block advice and am thrilled with the results.
You've been a real blessing to me, sir, and I thank you sincerely for your time and expertise on every aspect of this!

Here's the final function as it currently stands.  You've helped me grow by leaps and bounds from the first iteration!

Code: [Select]
Randomly play 1 of 5 "Acknowledged" Sound Responses
Play random sound (5 items)

Open the Galaxy Map and Click on the Navigation Bar
Pause 0.1 seconds
Press . > key and hold for 0.1 seconds and release
Pause 3 seconds
Move mouse cursor to screen coordinates (707, 128)
Pause 0.1 seconds
Click left mouse button
Pause 0.1 seconds

Randomly play 1 of 6 "Awaiting Input" Sound Responses
Play random sound (6 items)

Get User Spoken Input.  Loop until Spoken_Input = finished; done; go
Marker: Still Speaking
Set text [System_Input] to 'Null'
Wait for spoken response: 'a; b; beat; c; see; sea; seat; d; e; f; g; sheet; h; i; j; k; l; m; n; and; ; an; in; o; all; p; q; r; are; s; t; u; you; v; w; x; y; z; zero; one; two; three; four; five; ...'

Cancel Search and Leave Galaxy Map
Begin Text Compare : [System_Input] Equals 'cancel'
    Play sound, '{VA_SOUNDS}\hcspack-CARINA\Profile sounds\Generic\Comms\((RS - Cancel message))\non-verbose\Cancelled.mp3'
    Move mouse cursor to screen coordinates (99, 1007)
    Click left mouse button
    Stop VoiceAttack command processing
End Condition

Reset the Search Field if the User Inputs a reset command
Begin Condition : [System_Input] Equals 'clear' OR [System_Input] Equals 'start over' OR [System_Input] Equals 'restart' OR [System_Input] Equals 'reset'
    Move mouse cursor to screen coordinates (707, 95)
    Pause 0.1 seconds
    Click left mouse button
    Move mouse cursor to screen coordinates (707, 128)
    Pause 0.1 seconds
    Click left mouse button
    Pause 0.1 seconds
    Press Back key and hold for 0.1 seconds and release
    Jump to Marker: Still Speaking
End Condition

Delete the previous letter.
Begin Text Compare : [System_Input] Equals 'delete'
    Press Back key and hold for 0.1 seconds and release
    Jump to Marker: Still Speaking
End Condition

Go back one letter.
Begin Text Compare : [System_Input] Equals 'back'
    Press Left key and hold for 0.1 seconds and release
    Jump to Marker: Still Speaking
End Condition

Command was "finished/done/go".  Jump to Marker to start locking in the Route.
Begin Condition : [System_Input] Equals 'finished' OR [System_Input] Equals 'done' OR [System_Input] Equals 'go'
    Jump to Marker: Finished
End Condition

Correct troublesome inputs
Set text [System_Input] to [System_Input] (Replace 'zero' with '0')
Set text [System_Input] to [System_Input] (Replace 'one' with '1')
Set text [System_Input] to [System_Input] (Replace 'two' with '2')
Set text [System_Input] to [System_Input] (Replace 'three' with '3')
Set text [System_Input] to [System_Input] (Replace 'four' with '4')
Set text [System_Input] to [System_Input] (Replace 'five' with '5')
Set text [System_Input] to [System_Input] (Replace 'six' with '6')
Set text [System_Input] to [System_Input] (Replace 'seven' with '7')
Set text [System_Input] to [System_Input] (Replace 'eight' with '8')
Set text [System_Input] to [System_Input] (Replace 'nine' with '9')
Set text [System_Input] to [System_Input] (Replace 'beat' with 'B')
Set text [System_Input] to [System_Input] (Replace 'see' with 'C')
Set text [System_Input] to [System_Input] (Replace 'sheet' with 'G')
Set text [System_Input] to [System_Input] (Replace 'all' with 'O')
Set text [System_Input] to [System_Input] (Replace 'are' with 'R')
Set text [System_Input] to [System_Input] (Replace 'you' with 'U')
Set text [System_Input] to [System_Input] (Replace 'space' with ' ')
Set text [System_Input] to [System_Input] (Replace 'dash' with '-')

Type the current System_Input into the Search Bar.  Check to see if it needs a space.  If it does, add one.
Begin Condition : [System_Input] Equals 'lhs' OR [System_Input] Equals 'ltt' OR [System_Input] Equals 'lp' OR [System_Input] Equals 'hip' OR [System_Input] Equals 'epsilon' OR [System_Input] Equals 'ross' OR [System_Input] Equals 'wolf' OR [System_Input] Equals 'wredguia'
    Quick Input, '{TXT:System_Input} '
    Jump to Marker: Still Speaking
    System Input does not require a space.  Input as normal.
Else If : [System_Input] Does Not Equal 'lhs' OR [System_Input] Does Not Equal 'ltt' OR [System_Input] Does Not Equal 'lp' OR [System_Input] Does Not Equal 'hip' OR [System_Input] Does Not Equal 'epsilon' OR [System_Input] Does Not Equal 'wolf' OR [System_Input] Does Not Equal 'ross' OR [System_Input] Does Not Equal 'wredguia'
    Quick Input, '{TXT:System_Input}'
    Jump to Marker: Still Speaking
End Condition

Marker for finished Inputing
Marker: Finished

Click on the top listed search result to begin Plotting Route
Move mouse cursor to screen coordinates (703, 157)
Pause 0.1 seconds
Click left mouse button
Pause 0.1 seconds

Randomly play 1 of 3 "Selecting Destination" Sound Response
Play random sound (3 items)
Pause 3 seconds

Click on the "Plot Route" button on the right side of the UI
Move mouse cursor to screen coordinates (1822, 603)
Pause 0.1 seconds
Click left mouse button
Pause 0.1 seconds

Randomly play 1 of 2 "Destination Locked" Sound Response
Play random sound (2 items)
Pause 3 seconds

Exit the Galaxy Map
Move mouse cursor to screen coordinates (99, 1007)
Click left mouse button

SemlerPDX

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 291
  • Upstanding Lunatic
    • My AVCS Homepage
Re: Help setting Dictation Limitations
« Reply #8 on: April 05, 2023, 01:40:13 PM »
Take a look at the Tokens section in the VA Manual to see these extra helpers you can use. Knowing these tokens ahead of time can often help you simplify command actions when building systems later on.

For example, you can make use of the {TXTWORDTONUM} token to eliminate the following actions:
Code: [Select]
Correct troublesome inputs
Set text [System_Input] to [System_Input] (Replace 'zero' with '0')
Set text [System_Input] to [System_Input] (Replace 'one' with '1')
Set text [System_Input] to [System_Input] (Replace 'two' with '2')
Set text [System_Input] to [System_Input] (Replace 'three' with '3')
Set text [System_Input] to [System_Input] (Replace 'four' with '4')
Set text [System_Input] to [System_Input] (Replace 'five' with '5')
Set text [System_Input] to [System_Input] (Replace 'six' with '6')
Set text [System_Input] to [System_Input] (Replace 'seven' with '7')
Set text [System_Input] to [System_Input] (Replace 'eight' with '8')
Set text [System_Input] to [System_Input] (Replace 'nine' with '9')

...and you can use a single action with that token like this instead:
Code: [Select]
Set text [System_Input] to '{TXTWORDTONUM:System_Input}'

(as pictured)