Author Topic: Say and save data  (Read 3269 times)

dnthomps@shaw.ca

  • Guest
Say and save data
« on: February 20, 2018, 10:30:09 AM »
This should be part of the basic starter pack but I couldn't find it any where.

When playing ATS or E:D I want to be able to save my current job information so I can recall it as I fly/drive to my next destination. I have the recall part down but can not figure out how to save spoken words to a variable. I have:

Say, 'What is the Job your doing'
Start Dictation Mode (Clearing Dictation Buffer)
Pause 3.1 seconds
Stop Dictation Mode
Set Text [JobName] to [{DICTATION}]
Pause 3.1 seconds
Say, 'Oh your taking a load of {TXT:JobName}'

OK, I know there is a lot wrong here but where do I start trying to figure it out.

Oh: Is there a tutorial someplace that shows how to get the code from these posts into a profile command?

So far no joy.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4761
  • RTFM
Re: Say and save data
« Reply #1 on: February 20, 2018, 02:46:54 PM »
Is there a tutorial someplace that shows how to get the code from these posts into a profile command?
That's not actually possible, you have to recreate the command from the information given(which is good way to learn, in my opinion).

From your command, I can deduce that
Code: [Select]
Set Text [JobName] to [{DICTATION}]should be
Code: [Select]
Set Text [JobName] to '{DICTATION}'
Square brackets in this context indicate a variable name, and tokens are not variables; Tokens always return text, so they go in the "Text" field of your "Set a Text Value" action, rather than the "A variable" field.


Using a timer for your dictation is a perfectly valid way to do it(and it has advantages), but you can also have VoiceAttack wait until there's actually something dictated, before checking what it is:
Code: [Select]
Start Dictation Mode (Clearing Dictation Buffer)
Start Loop While : [{DICTATION}] Equals ''
End Loop
Stop Dictation Mode
Say, '{DICTATION}'
The loop will idle(I.E. keep waiting) indefinitely until the "{DICTATION}" token has a value(which is also why the buffer should be cleared first), and allow the command to execute the actions below it as soon as it does.

dnthomps@shaw.ca

  • Guest
Re: Say and save data
« Reply #2 on: February 20, 2018, 11:21:45 PM »
Thank you for your help. I was able to get this working.

Code: [Select]
Say, 'What is the Job your doing'
Start Dictation Mode (Clearing Dictation Buffer)
Start Loop While : [{DICTATION}] Equals ''
End Loop
Stop Dictation Mode
Set Text [JobName] to '{DICTATION}'
Pause 1 second
Say, 'Where is it going?'
Start Dictation Mode (Clearing Dictation Buffer)
Start Loop While : [{DICTATION}] Equals ''
End Loop
Stop Dictation Mode
Set Text [JobDestination] to '{DICTATION}'
Pause 1 second
Say, 'What is its mass'
Start Dictation Mode (Clearing Dictation Buffer)
Start Loop While : [{DICTATION}] Equals ''
End Loop
Stop Dictation Mode
Set Text [JobMass] to '{DICTATION}'
Pause 1 second
Say, 'What does it pay'
Start Dictation Mode (Clearing Dictation Buffer)
Start Loop While : [{DICTATION}] Equals ''
End Loop
Stop Dictation Mode
Set Text [JobRate] to '{DICTATION}'
Pause 1 second
Say, 'Oh your taking a load of {TXT:JobName}'
Pause 2.5 seconds
Say, 'And its going to {TXT:JobDestination}'
Pause 2 seconds
Say, 'It has a mass of {TXT:JobMass} tonnes'
Pause 2 seconds
Say, 'You will be paid {TXT:JobRate} dollars'

It works but Dictation leaves a lot to be desired, it got even worse after I did the voice training.

Is there another way to do this?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4761
  • RTFM
Re: Say and save data
« Reply #3 on: February 21, 2018, 07:24:20 AM »
Dictation is the most flexible way, as you don't have to define all possible values ahead of time, but you can use dynamic command sections to build a list of command phrases that the speech engine will try to match what you're saying against.

E.G.
Taking a load of [potatoes;milk;a rather large boat] to [denver;dallas;portland]
Code: [Select]
Set Text [JobName] to '{CMDSEGMENT:1}'
Set Text [JobDestination] to '{CMDSEGMENT:3}'
See page 118 and 119 of VoiceAttackHelp.pdf for more information on the "{CMDSEGMENT:}" token.


For numeric values especially, you need to decide which and how many options you want to cover, as the amount of generated commands will increase exponentially.

E.G.
Carrying [1..36] tonnes Will generate 36 command phrases, as you'd expect. However, if you add more options like Carrying [around;] [1..36] tonnes, it'll generate 72 command phrases.

The more command phrases that need to be generated, the longer your profile will take to load(both initially and when editing).


I'd recommend splitting up your settings across a few commands, as something like Taking a load of [potatoes;milk;a rather large boat] to [denver;dallas;portland] weighing [1..36] tonnes paying [1..100] dollars generates 32400 different phrases(with only a few of the possible loads/cities/weights/payouts filled in), whereas splitting each of those up only generates 142 instead.

dnthomps@shaw.ca

  • Guest
Re: Say and save data
« Reply #4 on: February 22, 2018, 12:27:10 PM »
Ok, baby steps. Thank your for your answers. I know its annoying but I am learning.

I took the command and broke it down into individual commands.

Code: [Select]
When I say: Job city [Oxnard;Carson City;Phoenix;Santa Cruz;Tucson;Roswell;Yuma;Santa Fe;Albuquerque;Barstow;Nogales;Bakersfield;Ukiah;Gallup;Primm;Reno;Kingman;Los Angeles;Grand Canyon Village;Tucumcari;Flag staff;Carlsbad Nm;San Diego;Sacramento;Jackpot;Elko;Camp Verde;Las Cruces;Alamogordo;Clovis;Holbrook;Pioche;Ely;Las Vegas;Socorro;Page;San_francisc;Fresno;Sierra Vista;Redding;Winnemucca;San Rafael;Raton;San Simon;Hobbs;El Centro;Oakland;Farmington;Carlsbad;Stockton;Santa Maria;San Francisco;Eureka;Huron;Show Low;Ehrenberg;Truckee;Kayenta;Artesia]

Set Text [JobDestination] to '{CMDSEGMENT:1}'
Pause 1 second
Say, 'We are delivering to {TXT:JobDestination}'

This works great (well unless I want Albuquerque which even my computer doesn't know how to say) but I would like to get back to the Prompt before giving the city name. Is it possible to have this word search within a command rather then using the 'When I say' line?

Also see that big list of city names (ATS) its going to get longer as time goes on. Is there a limit either to the # of Cities and/or characters in that string?

I tried to use
Code: [Select]
Say, 'What are you hauling'
Start Dictation Mode (Clearing Dictation Buffer)
Start Loop While : [{DICTATION}] Equals ''
End Loop
Stop Dictation Mode
Execute command, 'Job Type [Unknown;Tyres;Household Appliances;Dynamite;Roadroller;Fruits;Cables;Cars;Clothes;Office Supplies;Scraper;Sand;Aromatics;Pesticides;Bulldozer;Warlock Stout;Computers;Petrol;Propane;Beverages;Excavator;TVs;Diesel;Crawler Tractor;Mortar;Tableware;Toys;Xmas Gifts;Ethane;Fireworks;Home Accessories;Large Tubes;Frozen Fruits;Potassium;Mobile Barrier;Electronic Components;Silica;Digger 500]' (and wait until it completes)
Pause 3 seconds
Execute command, 'Job Description; Current Job; what am I hauling'

To pass data to the command but it failed.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4761
  • RTFM
Re: Say and save data
« Reply #5 on: February 22, 2018, 02:43:26 PM »
I would like to get back to the Prompt before giving the city name. Is it possible to have this word search within a command rather then using the 'When I say' line?
No, any predefined phrase must be a command trigger.

If you want a voice prompt, you are free to use a TTS action at the end of the command, even if the actual order doesn't matter(unless you set up a system that enforces it).


Also see that big list of city names (ATS) its going to get longer as time goes on. Is there a limit either to the # of Cities and/or characters in that string?
There is a limit, but not one you should run into in this context. The amount of characters is less relevant than the amount of permutations your command will generate, but even that isn't usually an issue when kept within reason.


I tried to use
Code: [Select]
Say, 'What are you hauling'
Start Dictation Mode (Clearing Dictation Buffer)
Start Loop While : [{DICTATION}] Equals ''
End Loop
Stop Dictation Mode
Execute command, 'Job Type [Unknown;Tyres;Household Appliances;Dynamite;Roadroller;Fruits;Cables;Cars;Clothes;Office Supplies;Scraper;Sand;Aromatics;Pesticides;Bulldozer;Warlock Stout;Computers;Petrol;Propane;Beverages;Excavator;TVs;Diesel;Crawler Tractor;Mortar;Tableware;Toys;Xmas Gifts;Ethane;Fireworks;Home Accessories;Large Tubes;Frozen Fruits;Potassium;Mobile Barrier;Electronic Components;Silica;Digger 500]' (and wait until it completes)
Pause 3 seconds
Execute command, 'Job Description; Current Job; what am I hauling'

To pass data to the command but it failed.

All commands should have access to the contents of "{DICTATION}" unless you clear the dictation buffer, are you using another method to pass data?