News:

HOT TIP! In the command editor, you can ctrl-click and drag an item to create a copy of it.

Main Menu

Status variable gives the previous status 2

Started by Haddood, March 19, 2015, 03:11:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Haddood

in version 2.142 it seems the status variable is listing the previous status

I am testing this command and the LED Colour lists the previous Status ...

(it will be great to have to variables, Status and Previous Status)

<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.4.2-->
<command id="862" name="LED Control" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)==(B)</ifType>
    <ifParams>{status}&amp;&amp;on</ifParams>
    <then>
      <action>
        <cmdType>PY.ExecString</cmdType>
        <params>
          <param>LEDcolour("Green")</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)==(B)</ifType>
    <ifParams>{status}&amp;&amp;off</ifParams>
    <then>
      <action>
        <cmdType>PY.ExecString</cmdType>
        <params>
          <param>LEDcolour("Red")</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)==(B)</ifType>
    <ifParams>{status}&amp;&amp;standby</ifParams>
    <then>
      <action>
        <cmdType>PY.ExecString</cmdType>
        <params>
          <param>LEDcolour("Yellow")</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <event>VC.On</event>
  <event>VC.Standby</event>
  <event>VC.Off</event>
</command>
When Voice command gets tough, use hand gestures

jitterjames

This is not specific to version 2.1.4.2

It is not that it is reporting the previous status, it is just that the event triggers immediately before the status variable is updated so in this particular command it is reporting the wrong value.  However quickly things might appear to take place on a computer, they still only happen one thing at a time!

Obviously it would be better if this variable was updated before the event is fired and I will look into that.

In the meantime you can work around it in one of two ways (at least).

1 - Use {LastEvent}
2 - Prefix your command name with a ++ so that it's threaded and then put a very short VC.Pause action at the beginning of your command.

Haddood

After a bit of more texting I reached the same conclusion and went with option 1 ... However I will try option 2 ...

Thanks
When Voice command gets tough, use hand gestures