Author Topic: Command tweak  (Read 868 times)

mnf1980

  • Newbie
  • *
  • Posts: 15
Command tweak
« on: April 28, 2020, 01:09:36 PM »
Hi
I have this command "When I Say" that eats up the memory and causes VA to crash (out of memory).

"When I Say" :
[Heading;Course][0;][0..360];[Heading;Course][0;][0..360][From;Current][0;][0..360]

I wonder if there is a better way to tweak this command and make it use less memory.

I want to be able to say:
Heading/Course 025
Heading/Course 180 From/Current 040
and so on...

I already made the command sequence, but the problem is I have 3 other similar commands and they use more memory and VA crash.

one more question:
is there a way to tell VA that the second part of the command is optional like ([From;Current][0;][0..360]):
[Heading;Course][0;][0..360][From;Current][0;][0..360]
regards

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Command tweak
« Reply #1 on: April 28, 2020, 01:32:09 PM »
There is not, however that would not reduce the amount of phrase variations in this case.

If you want to be able to speak "Heading 180" and "Heading 180 from 360", you still need both sets of phrases, just as you have them defined now.


You can, however, reduce the total amount of variations by only generating the ones you'll actually use.

E.G. I assume you're not going to say "0360", or "00"

A more efficient setup could look like this:
Code: [Select]
[Heading;Course]0;[Heading;Course]0[1..99];[Heading;Course][100..360];[Heading;Course]0[1..99][From;Current]0[1..99];[Heading;Course]0[1..99][From;Current][100..360];[Heading;Course][100..360][From;Current][100..360];[Heading;Course][100..360][From;Current]0[1..99];[Heading;Course]0[From;Current]0;[Heading;Course]0[From;Current]0[1..99];[Heading;Course]0[From;Current][100..360];[Heading;Course]0[1..99][From;Current]0;[Heading;Course][100..360][From;Current]0
That generates 522,006 variations, instead of the 2,080,804 variations you're generating now.

mnf1980

  • Newbie
  • *
  • Posts: 15
Re: Command tweak
« Reply #2 on: April 28, 2020, 02:47:56 PM »
Thanks, I get your point, but now I'm facing another problem...

First, I added [0;] to the command to be able to say "Heading 90" and "Heading 090" ([Heading;Course][0;][1..99] and so on..)

I was using {CMDSEGMENT} to get the value from the command, but now it is more difficult to find the numbers.
{TXTNUM} is not helpful either as it is not always 6 digits!

How to get the numbers before and after "From/Current"?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Command tweak
« Reply #3 on: April 28, 2020, 03:21:53 PM »
Here's one way to do it, using either "from" or "current" as the separator between both:
Code: [Select]
Begin Text Compare : [{CMD}] Contains 'From'
    Set integer [~separatorPosition] value to the converted value of {TXTPOS:"from":"{CMD}":0}
Else
    Set integer [~separatorPosition] value to the converted value of {TXTPOS:"current":"{CMD}":0}
End Condition
Set integer [firstValue] value to the converted value of {TXTNUM:"{TXTSUBSTR:"{CMD}":0:~separatorPosition}"}
Set integer [secondValue] value to the converted value of {TXTNUM:"{TXTSUBSTR:"{CMD}":~separatorPosition:}"}
This does assume you're already checking whether the optional part of the phrase was spoken, and that the above is only executed if it is.

mnf1980

  • Newbie
  • *
  • Posts: 15
Re: Command tweak
« Reply #4 on: April 28, 2020, 06:11:20 PM »
thanks, dear
it works like a charm