VoxCommando

New Features and Feature Requests => Feature Requests => Topic started by: marcusvdt on June 27, 2015, 07:25:14 PM

Title: Is it possible to make the changes to prefix scriptable?
Post by: marcusvdt on June 27, 2015, 07:25:14 PM
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!
Title: Re: Is it possible to make the changes to prefix scriptable?
Post by: Haddood on June 28, 2015, 02:58:03 AM
Check vcadvanced.setoption
There was a discussion on the forums about that
Title: Re: Is it possible to make the changes to prefix scriptable?
Post by: nime5ter on June 28, 2015, 09:02:53 AM
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.

Code: [Select]
<?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.
Title: Re: Is it possible to make the changes to prefix scriptable?
Post by: marcusvdt on June 28, 2015, 01:27:00 PM
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