News:

VoxCommando works with Amazon Echo, Domoticz, EventGhost, Google Assistant, IFTTT, iTunes, J.River Media Center, Kodi, MediaMonkey, Nest, Philips Hue, Vera, Wemo, and the list keeps growing!

Main Menu

Is it possible to make the changes to prefix scriptable?

Started by marcusvdt, June 27, 2015, 07:25:14 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

marcusvdt

The purpose would be to give the computer a name.

I could tell for example:
Maria, now your name will be Stella.
(Maria being the current prefix and Stella being the new one to be saved).
(This new name should allow for alternates with a specific action like vc.prefixAdd)

Then VC would respond:
Wait some minutes while I rebuild my systems with this new name.
(in this meantime, VC would need to rebuild stuff, clear cache or something)

Then I could ask:
what is your name?

And it would tell me:
My master told me my name is Stella.
(If there are alternates, I could get a random name from the list of alternates vc.prefixGetName && random, or a specific one vc.prefixGetName && n)

Obviously I would need to have a group to put this questions in,  which allows for always listening for commands without a prefix (is it even possible?), or alternatively, I would need to have a group that has a more generic prefix, like "computer" and/or "machine" for example.

Thanks!

Haddood

Check vcadvanced.setoption
There was a discussion on the forums about that
When Voice command gets tough, use hand gestures

nime5ter

Here's a starting point for changing the prefix and for adding a prefix to a list of existing prefixes and having one prefix randomly chosen from that list.

<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.5.0-->
<commandGroup open="True" name="prefix tests" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="582" name="Change prefix" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>VC.SetOption</cmdType>
      <params>
        <param>Prefix</param>
        <param>{1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Group.Purge</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Group.RefreshAll</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.GetOption</cmdType>
      <params>
        <param>Prefix</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Prefix is now: {LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Change prefix to</phrase>
    <payloadList>Maria, Bridget, Paolo, Marcus, Beluga</payloadList>
  </command>
  <command id="587" name="Add an alternate prefix" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>VC.GetOption</cmdType>
      <params>
        <param>Prefix</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.SetOption</cmdType>
      <params>
        <param>Prefix</param>
        <param>{LastResult},{1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Group.Purge</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Group.RefreshAll</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.GetOption</cmdType>
      <params>
        <param>Prefix</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Prefix is now: {LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <params>
        <param>(\w+)</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.AddText</cmdType>
      <params>
        <param>Here's a random prefix:  {Match.Rnd}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Add the prefix</phrase>
    <payloadList>Maria, Bridget, Paolo, Marcus, Beluga</payloadList>
  </command>
</commandGroup>


These changes to options are just temporary so if you restart VC the prefixes will revert back to the main options settings. Somewhere on the forum I think that Haddood gives an example of writing to the Options.xml file to permanently overwrite a particular setting.
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)

marcusvdt

Thank you, I'll look for that. I'm going to use parts of the example you posted and will take a look at options.xml