Hi Dan and welcome to the VC Forum.
Ok, I will here explain step by step how it works and hope in this way some user learn a bit about using a Maptable, trigger events ...
To write here a desciption take me some hours, because english is not my native language and also I will get safe that each step will work for all users.
I use Denise as TTS output instead or also with the TTS.Speak action from VC, with the advantage that "Denise" can run on the same or any other machine as VC. So in this way you can have, for example, in each room a pc with a installed Guile3D bot like Denise, Spock or each other bot character with different voices. In theory you can say "Computer, I'm in the living room" and only the bot in the living room will talk to you.
To do this, we need a special Command Group in which this functions all managed, because there are more than one action to do this.
It is important to know, that we must have the data which should be "Denise" say in VC {LastResult} stored or stored on a place from which "Denise" can pick up the data (eg. in a txt file).
This can be done in different ways, but I will descibe here only the {LastResult} way.
1. Go safe, that you have connected the bot within the command group some posts above
http://voxcommando.com/forum/index.php?topic=1650.msg14407#msg14407 if the bot speak aloud with lip sync: "Yes I can ..." the first step is done and now you have allready access to the bot. If not, please open the VC command editor, select the connect command by a double click and check that the IP-address, username and password are correct written and don't forget that the guile3D software must already run before you connect to the bot. Any error will highlighted orange in the VC history window and when you move the mouse over you can read what is wrong.
What the "connect" command do:The
connect command is triggered by the VC.Loaded event which will fired when VoxCommando start. The whole command create a Maptable in VC (by overwriting a existed key) and store the "AuthKey" automatically in this Maptable. This is necessary, because when you close the Guile3D software, it will create a new AuthKey each time and with this way everything is automated and you must do nothing by hand
The last action in the connect command will set the voice of the bot, which mean it overwrite the voice which is set in the bot software. Get safe that this TTS voice exist on your system, otherwise change the name to a name who exist or you can delete/disable this action if you use always the same voice.
--------------------------------------------------------------------------------------------------------------------------------------------------------------
From now on we can abbreviate everything if you want to know only how you get "TTS feedback" from XBMC or other stuff (like what song is this) to your bot without going to much in detail, then you need only to replace one action in your existing commands. Replace the TTS.Speak or TTS.SpeakSync with one scrape action. To make it easy copy the following command in a existing command group and open the command in the VC Editor to see what is going on. The VC.Pause action at the end of the command is required when you use XJson.SoftMute and XJson.SoftUnMute, because VC will execute the unmute action before the text is spoken by your bot. There is also a other trick to let the bot speak first before the unmute is executed without the VC.Pause, maybe I will this explain later if it is a wish.here the fast way command code:
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.0.0.3-->
<command id="780" name="What song is this with bot speak" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>XJson.SoftMute</cmdType>
<params>
<param>60</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>XJson.Raw</cmdType>
<params>
<param>Player.GetItem</param>
<param>"playerid":0, "properties": ["title", "album", "artist", "rating","playcount","genre"]</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>XJson.ParseTokens</cmdType>
<params>
<param>This is {item.title}, by {item.artist[[&]]}</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>Scrape</cmdType>
<params>
<param>http://127.0.0.1:8000/Agent?function=AgentSpeak&Auth={M:botpass.botpass}&Text={LastResult}</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>OSD.ShowText</cmdType>
<params>
<param>{LastResult}</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>VC.Pause</cmdType>
<params>
<param>2500</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>XJson.SoftUnMute</cmdType>
<params />
<cmdRepeat>1</cmdRepeat>
</action>
<phrase>What, Which, wie heist der, welcher</phrase>
<phrase>song, track</phrase>
<phrase optional="true">is this, ist dass</phrase>
</command>
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The second command in this group is called "3D bot speak" and how the name said, it will send the data from{LastResult} to the bot, which speak it aloud.
This command has only one action (at the moment). It is the VC "Scrape" action in which contains the bot function "AgentSpeak" followed by the auto generated "AuthKey" from the Maptable {M:botpass.botpass} and the text which the bot should be speak from the {LastResult}. The command will triggered by the "bot speak" event (the calendar icon with digit 9).
The last command in this group "speak test" will show you in which way you send the {LastResult} to the bot. It contains two actions "Result.SetLastResult" which set all what is typed here in as {LastResult}. This can be text, {Match.x} or any other Data which we will send to speak aloud with the bot.
The second action is "VC.TiggerEvent" with the parameter "bot speak" - this trigger any command which contain the event "bot speak" and in our case it trigger the command "3D bot speak", because the command contain the "bot speak" event in his tree.
As next the bot
show/hide function - first, copy the following code in your VC command tree:
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.0.0.3-->
<commandGroup open="True" name="guile3D show/hide" enabled="True" prefix="" priority="0" requiredProcess="" description="">
<command id="1513" name="show bot" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>Scrape</cmdType>
<params>
<param>http://127.0.0.1:8000/Agent?function=AgentShow&Auth={M:botpass.botpass}&STATE=wsMaximized</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>Scrape</cmdType>
<params>
<param>http://127.0.0.1:8000/Agent?function=AgentPosition&Auth={M:botpass.botpass}&left=1920&top=66</param>
</params>
<cmdRepeat>0</cmdRepeat>
</action>
<phrase>show</phrase>
<phrase>denise</phrase>
<event>VC.Prefix.Start</event>
<event>show 3Dbot</event>
</command>
<command id="1477" name="3D bot hide event" enabled="true" alwaysOn="True" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>Scrape</cmdType>
<params>
<param>http://127.0.0.1:8000/Agent?function=AgentSpeak&Auth={M:botpass.botpass}&Text=you welcome!</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>VC.SetEventTimer</cmdType>
<params>
<param>2</param>
<param>hide bot</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<phrase optional="true">please, yes I know, I know, ok</phrase>
<phrase>ok thanks, ok bye, hide in background, please be quiet, be quiet</phrase>
</command>
<command id="1518" name="3D bot hide" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>Scrape</cmdType>
<params>
<param>http://127.0.0.1:8000/Agent?function=AgentShow&Auth={M:botpass.botpass}&STATE=wsMinimized</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<event>hide bot</event>
</command>
</commandGroup>
This group contains 3 commands:
The first command in this group is the "
show bot" command, which can execute here in 3 different ways.
1. by saying the phrase "show Denise"
2. triggered by the event "VC.Prefix.Start" when you say your prefix in standby mode (only if you have enabled the prefix mode in VC Options). For example: If your prefix is "denise" and you say first "denise" followed by any command, the bot will show up.
3. triggered by the event "
show 3Dbot" which can you fired by insert a "VC.TriggerEvent" with parameter
show 3Dbot in any command to show the bot
this command contains two "Scrape" actions: the first one maximize the bot and the second (is optional - diabled as default) move the bot to a specified postion on the screen (maybe you have two screens, then this is a good option to place it).
The second command is the "
3D bot hide event" fired a event to hide the bot and contains two actions.
1. a "Scrape" action which send the text "you're welcome" directly to the bot.
2. a "VC.SetEventTimer" action, which fire the event "hide bot" after waiting 2 seconds.
When you saying the phrase "ok thanks, ok bye, hide in background, please be quiet, be quiet" (note that there are a optional phrases "please, yes I know, I know, ok" which can you say first, but it is not necessary).
This command has one important feature: If you take a look on it in the VoxCommando command tree ->the command name is showing
bold, which means it is
always ON - VC recognize and execute this command without a prefix in stanby mode. So if you are in ON or standby mode makes no different, the bot will hide when you say "ok thanks, ok bye ...". How you can change this feature will you find here:
http://voxcommando.com/mediawiki/index.php?title=Logical_Command_BuilderThe third command from this group is the "3D bot hide" and contain one action.
1. a "Scrape" action which minimize the bot. This command is triggered by the "hide bot" event which is fired from the VC.SetEventTimer" above.
The story will continue later, - need a break
Kalle