Author Topic: Is it possible to pass a var to VC.Pause?  (Read 1285 times)

0 Members and 1 Guest are viewing this topic.

Methos

  • Jr. Member
  • **
  • Posts: 14
  • Karma: 0
    • View Profile
Is it possible to pass a var to VC.Pause?
« on: July 09, 2014, 02:26:00 PM »
Hello I was trying to get vc to pause for a random interval between 4000 and 9000ms.

So I made a python script that uses random.choice and can choose from 4000 to 9000 in thousand increments, it then assigns the result to var.pauseDelay.
This works fine and var.pauseDelay gets a correct value, if I do "OSD.ShowText {var.pauseDelay}" I'll get 5000 or some other valid #.
Then I did "VC.Pause {var.pauseDelay}" but it doesn't work, vc.pause never fires in the log.

Will it accept a variable or is there a better way to accomplish this task?

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Is it possible to pass a var to VC.Pause?
« Reply #1 on: July 09, 2014, 02:51:06 PM »
Interesting. I think that may be a bug. James will have to let us know later. Maybe VC.Pause requires an integer, and is reading the variables as a string?

It depends on what your objective is, but for such long pauses you might want to use VC.SetEventTimer instead, setting it to trigger another command in {Rnd.4.9}s.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.0.0.0-->
<commandGroup open="True" name="pause execution" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="339" name="pause execution" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>pausing this task</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>pausing this task</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.SetEventTimer</cmdType>
      <params>
        <param>{Rnd.4.9}s</param>
        <param>nextStep</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>pause execution</phrase>
  </command>
  <command id="355" name="now talking" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Pause over. Now continuing next phase of The Operation.</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>Now continuing task.</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>nextStep</event>
  </command>
</commandGroup>
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Is it possible to pass a var to VC.Pause?
« Reply #2 on: July 09, 2014, 03:19:58 PM »
It is a bug.  VC.Pause is the one action that does not replace variables strings, so anything in {} will not be replaced.  This can be fixed.

As always, it would be much easier to suggest a better method if we had some idea of your end goal.

SetEventTimer is probably the best way to do it, but if you are using python you can do the pause directly in your python script using time.sleep().

You might like to know that we already have a random number generator variable for VC actions of the form {Rnd.Min.Max}
http://voxcommando.com/mediawiki/index.php?title=Variables#.7BRnd.1.10.7D

Of course it won't help in this case because the VC.Pause won't replace it.