Author Topic: Not work 2+ Confirms if emulate 2nd+ commands  (Read 2432 times)

0 Members and 1 Guest are viewing this topic.

Aniv_D

  • Jr. Member
  • **
  • Posts: 42
  • Karma: 10
    • View Profile
Not work 2+ Confirms if emulate 2nd+ commands
« on: February 18, 2019, 02:05:52 AM »
I'm sorry, but I have a new batch of work for you. ;D
Bug or No? pic1.
addition: if you say no or keep silent, then an error will pop up in the log. but this is probably another problem (the function is not affected) pic2.
Thanks
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.4.5-->
<commandGroup open="True" name="Test 2+ Confirms" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="108" name="Start Command 1" enabled="true" alwaysOn="False" confirm="True" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Confirm Command 1 OK</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.TellVox</cmdType>
      <params>
        <param>Start Command 2</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Start Command 1</phrase>
  </command>
  <command id="127" name="Confirm Start Command 1" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Confirm Command 1</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.AddText</cmdType>
      <params>
        <param>Need confirm. Say Yes or No</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>Confirm.Start Command 1</event>
  </command>
  <command id="109" name="Start Command 2" enabled="true" alwaysOn="False" confirm="True" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Confirm Command 2 OK</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.TellVox</cmdType>
      <params>
        <param>Start Command 3</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Start Command 2</phrase>
  </command>
  <command id="164" name="Confirm Start Command 2" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Confirm Command 2</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.AddText</cmdType>
      <params>
        <param>Need confirm. Say Yes or No</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>Confirm.Start Command 2</event>
  </command>
  <command id="110" name="Start Command 3" enabled="true" alwaysOn="False" confirm="True" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Confirm Command 3 OK</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Start Command 3</phrase>
  </command>
  <command id="140" name="Confirm Start Command 3" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Confirm Command 3</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.AddText</cmdType>
      <params>
        <param>Need confirm. Say Yes or No</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>Confirm.Start Command 3</event>
  </command>
</commandGroup>
« Last Edit: February 18, 2019, 05:55:57 AM by Aniv_D »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Not work 2+ Confirms if emulate 2nd+ commands
« Reply #1 on: February 18, 2019, 12:40:07 PM »
When you use TellVox, the command with the TellVox action does not complete its execution until the emulated command completes its execution.

So command 1 calls command 2.  Command 1 is still executing, while waiting for command 2 to complete.  Command 2, when you confirm it, calls command 3.  Now command 2 is waiting for command 3, and command 1 is waiting for command 2.  But only one command can be the command that needs confirmation, so an error occurs.

I am not sure if this is something I can fix in the program, but there are at least two ways to avoid the problem.  Instead of using TellVox you can use SetEventTimer to call the next command.  This way the first command finishes executing.  Another option is to use ++ at the beginning of the command names that require confirmation.  Commands that start with ++ do not wait for actions to complete before going to the next action.  Avoid using ++ unless you need it because it can cause some unexpected behaviour in some cases.

Using event timers:
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.4.5-->
<commandGroup open="True" name="Test 2+ Confirms" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="126" name="Start Command 1" enabled="true" alwaysOn="False" confirm="True" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Confirm Command 1 OK</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.SetEventTimer</cmdType>
      <params>
        <param>1</param>
        <param>cmd2</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Start Command 1</phrase>
  </command>
  <command id="137" name="Confirm Start Command 1" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Confirm Command 1</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.AddText</cmdType>
      <params>
        <param>Need confirm. Say Yes or No</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>Confirm.Start Command 1</event>
  </command>
  <command id="146" name="Start Command 2" enabled="true" alwaysOn="False" confirm="True" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Confirm Command 2 OK</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.SetEventTimer</cmdType>
      <params>
        <param>1</param>
        <param>cmd3</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>cmd2</event>
  </command>
  <command id="174" name="Confirm Start Command 2" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Confirm Command 2</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.AddText</cmdType>
      <params>
        <param>Need confirm. Say Yes or No</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>Confirm.Start Command 2</event>
  </command>
  <command id="120" name="Start Command 3" enabled="true" alwaysOn="False" confirm="True" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Confirm Command 3 OK</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Start Command 3</phrase>
    <event>cmd3</event>
  </command>
  <command id="186" name="Confirm Start Command 3" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Confirm Command 3</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.AddText</cmdType>
      <params>
        <param>Need confirm. Say Yes or No</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>Confirm.Start Command 3</event>
  </command>
</commandGroup>


I will investigate the other bug but I think you are right, it probably does not cause any problems.  I think VC is trying to hide the window which was never opened.  The error does not cause any problems except to cause confusion for the user.
« Last Edit: February 19, 2019, 10:15:10 PM by nime5ter »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Not work 2+ Confirms if emulate 2nd+ commands
« Reply #2 on: February 18, 2019, 12:46:21 PM »
The other method is to use ++ in your command names in order to let commands run in their own thread:
(Note that because I changed the command names, I also had to change the event triggers to match.)

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.4.5-->
<commandGroup open="True" name="Test 2+ Confirms" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="128" name="++Start Command 1" enabled="true" alwaysOn="False" confirm="True" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Confirm Command 1 OK</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.TellVox</cmdType>
      <params>
        <param>Start Command 2</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Start Command 1</phrase>
  </command>
  <command id="161" name="Confirm Start Command 1" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Confirm Command 1</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.AddText</cmdType>
      <params>
        <param>Need confirm. Say Yes or No</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>Confirm.++Start Command 1</event>
  </command>
  <command id="129" name="++Start Command 2" enabled="true" alwaysOn="False" confirm="True" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Confirm Command 2 OK</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.TellVox</cmdType>
      <params>
        <param>Start Command 3</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Start Command 2</phrase>
  </command>
  <command id="198" name="Confirm Start Command 2" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Confirm Command 2</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.AddText</cmdType>
      <params>
        <param>Need confirm. Say Yes or No</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>Confirm.++Start Command 2</event>
  </command>
  <command id="130" name="Start Command 3" enabled="true" alwaysOn="False" confirm="True" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Confirm Command 3 OK</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Start Command 3</phrase>
  </command>
  <command id="208" name="Confirm Start Command 3" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Confirm Command 3</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.AddText</cmdType>
      <params>
        <param>Need confirm. Say Yes or No</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>Confirm.Start Command 3</event>
  </command>
</commandGroup>

In my opinion, the first method with event timers is probably better but it might depend on what you are actually trying to do.
« Last Edit: February 19, 2019, 10:15:57 PM by nime5ter »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Not work 2+ Confirms if emulate 2nd+ commands
« Reply #3 on: February 18, 2019, 01:02:45 PM »
OH!  I almost forgot.

The third and BEST solution is to use the events which are automatically generated any time a command is confirmed.

When the user confirms a command named "XYZ" the event Confirmed.XYZ will be generated.  The event is only generated AFTER the command has been confirmed and there are no other actions so the command finishes  executing immediately. This way, there is no problem caused by commands waiting for other commands to finish executing.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.4.5-->
<commandGroup open="True" name="Test 2+ Confirms" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="132" name="Start Command 1" enabled="true" alwaysOn="False" confirm="True" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Confirm Command 1 OK</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Start Command 1</phrase>
  </command>
  <command id="155" name="Confirm Start Command 1" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Confirm Command 1</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.AddText</cmdType>
      <params>
        <param>Need confirm. Say Yes or No</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>Confirm.Start Command 1</event>
  </command>
  <command id="121" name="Start Command 2" enabled="true" alwaysOn="False" confirm="True" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Confirm Command 2 OK</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>Confirmed.Start Command 1</event>
  </command>
  <command id="176" name="Confirm Start Command 2" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Confirm Command 2</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.AddText</cmdType>
      <params>
        <param>Need confirm. Say Yes or No</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>Confirm.Start Command 2</event>
  </command>
  <command id="122" name="Start Command 3" enabled="true" alwaysOn="False" confirm="True" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Confirm Command 3 OK</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>Confirmed.Start Command 2</event>
  </command>
  <command id="181" name="Confirm Start Command 3" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Confirm Command 3</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.AddText</cmdType>
      <params>
        <param>Need confirm. Say Yes or No</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>Confirm.Start Command 3</event>
  </command>
</commandGroup>

Aniv_D

  • Jr. Member
  • **
  • Posts: 42
  • Karma: 10
    • View Profile
Re: Not work 2+ Confirms if emulate 2nd+ commands
« Reply #4 on: February 18, 2019, 03:11:52 PM »
Thank you jitterjames.
All examples are good. That's right.
I thought that the commands requiring confirmation can be activated only by voice, so I used TellVox instead of Events.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Not work 2+ Confirms if emulate 2nd+ commands
« Reply #5 on: February 20, 2019, 09:20:12 AM »
I think that was true a long time ago.