Author Topic: Best method for long delays ?  (Read 4923 times)

0 Members and 1 Guest are viewing this topic.

xtermin8r

  • $upporter
  • Sr. Member
  • *****
  • Posts: 366
  • Karma: 9
  • Crunchie
    • View Profile
Best method for long delays ?
« on: December 28, 2012, 08:09:08 PM »
hola

I need a delay of 8 seconds between 2 commands. i have tried vc.pause, what other methods are there that do not freeze voxcommando ?
Neural Net Based Artificial Intelligence.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Best method for long delays ?
« Reply #1 on: December 28, 2012, 09:31:03 PM »
use VC.SetEventTimer

it works similar to VC.TriggerEvent but with a delay

xtermin8r

  • $upporter
  • Sr. Member
  • *****
  • Posts: 366
  • Karma: 9
  • Crunchie
    • View Profile
Re: Best method for long delays ?
« Reply #2 on: December 29, 2012, 08:29:01 AM »
use VC.SetEventTimer

it works similar to VC.TriggerEvent but with a delay

muchas gracias
Neural Net Based Artificial Intelligence.

xtermin8r

  • $upporter
  • Sr. Member
  • *****
  • Posts: 366
  • Karma: 9
  • Crunchie
    • View Profile
Re: Best method for long delays ?
« Reply #3 on: January 07, 2013, 01:37:13 PM »
Problem with VC.SetEventTimer, doesn't seem to work, any ideas ?

[attachment=1]
Neural Net Based Artificial Intelligence.

Dave

  • $upporter
  • Sr. Member
  • *****
  • Posts: 139
  • Karma: 31
    • View Profile
Re: Best method for long delays ?
« Reply #4 on: January 07, 2013, 01:56:41 PM »
vc.SetEventTimer triggers an event after a specific time, so you can't use it in exactly the same way like vc.pause.
take a look here:
http://voxcommando.com/mediawiki/index.php?title=Actions#SetEventTimer

xtermin8r

  • $upporter
  • Sr. Member
  • *****
  • Posts: 366
  • Karma: 9
  • Crunchie
    • View Profile
Re: Best method for long delays ?
« Reply #5 on: January 07, 2013, 02:13:55 PM »
@Dave
thanks for the reply, the thing is i dont want to trigger another event, it means that i will need to trigger an event for every long delay i need , makes no sense.
Neural Net Based Artificial Intelligence.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Best method for long delays ?
« Reply #6 on: January 07, 2013, 05:40:01 PM »
It is what it is.  I think for your purposes you should be able to use either method, but the trigger event action is obviously for triggering events, and requires two parameters, not one.

You can also include a payload in your event to make it more versatile.  In this case the event could be "key press" and the payload could be the key.  In the command that is triggered by the event, you can use {1} to get the value of the key.

Dave

  • $upporter
  • Sr. Member
  • *****
  • Posts: 139
  • Karma: 31
    • View Profile
Re: Best method for long delays ?
« Reply #7 on: January 08, 2013, 07:02:36 AM »
you could use logic blocks if you don't want to trigger 3 different events...
try this!
[attachment=1]




xtermin8r

  • $upporter
  • Sr. Member
  • *****
  • Posts: 366
  • Karma: 9
  • Crunchie
    • View Profile
Re: Best method for long delays ?
« Reply #8 on: January 08, 2013, 02:41:22 PM »
Thanks Dave, i will give it a shot.
Neural Net Based Artificial Intelligence.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Best method for long delays ?
« Reply #9 on: January 08, 2013, 05:06:13 PM »
here is an alternative method:

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="True" name="delayed keys" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="823" name="first command" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>XBMC.ExecBuiltin</cmdType>
      <cmdString>playmed...</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.SetEventTimer</cmdType>
      <cmdString>5&amp;&amp;presskeys&amp;&amp;a</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.SetEventTimer</cmdType>
      <cmdString>10&amp;&amp;presskeys&amp;&amp;w</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
  </command>
  <command id="840" name="press keys" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>SendKeys</cmdType>
      <cmdString>{1}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>presskeys</event>
  </command>
</commandGroup>
« Last Edit: January 08, 2013, 05:08:22 PM by jitterjames »

xtermin8r

  • $upporter
  • Sr. Member
  • *****
  • Posts: 366
  • Karma: 9
  • Crunchie
    • View Profile
Re: Best method for long delays ?
« Reply #10 on: January 08, 2013, 06:24:10 PM »
@James

Your method  does not work properly. both VC.SetEventTimer are triggered together.
« Last Edit: January 08, 2013, 06:43:14 PM by jitterjames »
Neural Net Based Artificial Intelligence.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Best method for long delays ?
« Reply #11 on: January 08, 2013, 06:42:48 PM »
Weird.  I tested it here and it worked perfectly.  How did you implement it?  did you copy and paste or recreate it by hand?

xtermin8r

  • $upporter
  • Sr. Member
  • *****
  • Posts: 366
  • Karma: 9
  • Crunchie
    • View Profile
Re: Best method for long delays ?
« Reply #12 on: January 08, 2013, 06:53:03 PM »
hi James
copy and paste.
Neural Net Based Artificial Intelligence.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Best method for long delays ?
« Reply #13 on: January 08, 2013, 07:24:33 PM »
I can't explain it.  Works exactly as expected on my system.

Can you send me your voicecommands.xml ?

here's the group again as an exported xml file, just in case...

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Best method for long delays ?
« Reply #14 on: January 08, 2013, 07:27:40 PM »
 >:(

You may have copied and pasted, but then you ust have edited it, because I just looked at your image again, and you changed the delay of 10 seconds to a delay of 5, so both are delayed by 5 seconds, so that is why they both fire at the same time!  You just need to change the second one back to 10 seconds and it will work perfectly.