All Tutorials / Jlucben / Synbot Plugin Tutorial - interface to Syn Bot Software

Synbot Plugin Tutorial - interface to Syn Bot Software

Step 8 : Advanced Plugin Configuration options

Plugin configuration form is only available when no Bot session active (Bot stopped)

User-inserted image

Link to EZ Scripts

You can configure in Response Variable field the EZ Builder variable name where the text part of the Bot Response will be stored - default is $SynbotTextResponse

You can configure EZ Builder Scripts to execute :

. When the plugin received a Bot Response (Field Response Script)
. Just after a Bot session start (Field Start Script)
. Just before a bot session stop (Field Stop Script) - BE CAREFUL This script cannot include Bot Commands or Bot Variables Getting or settings

Bot response interpretating options

Text Part of the Bot Response if existing will send automatically a SAY or a sayEZB command to EZ Builder with nowait.
you can configure the following options for the text message interpretation :.
If box speak response is unchecked , No SAY commands are executed
. If box speak response is ckecked
. Case box Use EZB-V4 speaker is ckecked , SayEZB("text message") is executed
. if not checked - Say("text message") is executed

If text message begin with | character the message is only displayed on Bot Console , whenever the speak flags settings

If box execute response command is checked , Command part of Bot response will be lauched in execution by EZ Builder.
If not checked , Command part is only displayed on the Console.
Default is checked.

box Log Full bot Response is only for debug ( so get unchecked)

Default Language

When a bot session is started , First part of the Combo Box value(The language code) is stored in the Bot USER variable "Userlanguage" and can be used and tested in SIML files

Robot Type

When a bot session is started , field value( is stored in the Bot USER variable "Robottype" and can be used and tested in SIML files

Init Bot event

You can configure a Bot Event which will be raised after starting a Bot session.
In this Bot event, you can do some initializations for the session( for example Bot variables value settings)
Default is BOT INIT EVENT
Below is the SIML models used in the example files to manage this init Bot event.
Speech settings EZB Control must be active in order to set the voice parameters.

Code:

[Event]
[Pattern]BOT INIT EVENT[/Pattern]
[Response xml:space="preserve"]
[Think]
[Bot Set="Empty-Match"][/Bot]
[Bot Set="Deltaspeed_leftright"]30[/Bot]
[Var Set="Controlrobottype"][Map Get="typerobot"][User Get="Robottype" /][/Map][/Var]
[!--test if Controlrobottype = RobotType in this case the robottype is not existing in the bot robot table - no control depending on Robottype will be done after --]
[!--User variable indrobot is set to the index to control in the flag arrays - if empty no control will be done--]
[Var Set="Okrobot"][x:Compare]{Bind Var:Controlrobottype}%equal%{Bind User:Controlrobottype}[/x:Compare][/Var]
[If Var="Okrobot" Value="true"][User Set="indrobot"][/User][/If]
[Else][User Set="indrobot"][Var Get="Controlrobottype" /][/User][/Else]

[Switch User="Userlanguage"]
[Case Value="fr"][x:EZcmd]ControlCommand("Speech Settings", SetVoice, "CereVoice Suzanne - French [France]")[/x:EZcmd][/Case]
[Case Value="en"][x:EZcmd]ControlCommand("Speech Settings", SetVoice, "Microsoft Zira Desktop")[/x:EZcmd][/Case]
[/Switch]
[x:EZcmd]ControlCommand("Speech Settings", SetVoiceEmphasis, "Reduced")|ControlCommand("Speech Settings", SetVoiceRate, "Medium")[/x:EZcmd]
[Switch User="Robottype"]
[Case Value="JD"][Bot Set="robottypefr"]un robot humanoïde[/Bot][Bot Set="robottypeen"]an humanoid robot[/Bot][/Case]
[Case Value="ROLLI"][Bot Set="robottypefr"]un robot à chenilles[/Bot][Bot Set="robottypeen"]a rolling rover robot[/Bot][/Case]
[/Switch]
[Bot Set="Empty-Response"]
[Switch User="Userlanguage"]
[Case Value="fr"][Random Get="Sorry_fr" /] JE NE SAIS PAS RéPONDRE à ta demande bis[/Case]
[Case Value="en"][Random Get="Sorry_en" /] I Don't understand your request[/Case]
[/Switch]
[/Bot]
[Bot Set="Timeout-Response"]
[Switch User="Userlanguage"]
[Case Value="fr"][Random Get="Sorry_fr" /][Random] Le temps nécessaire pour traiter ta demande est trop long[/Random][/Case]
[Case Value="en"][Random Get="Sorry_en" /][Random] Your request has timed out[/Random][/Case]
[/Switch]
[/Bot]
[/Think]
[/Response]
[/Event]


Bot Welcome

You can configure a user Welcome Message which will be automatically sent to the Bot after starting a Bot session and after the init Bot event management.
Default is WELCOME TO SYNBOT

If user name is not set , a dialog is initiated by the Bot asking user to input his name.
Userlanguage variable is tested to adapt bot dialogs and bot Below is the SIML models used in the example files to manage this welcome message.
responses to the user language (fr and en are only supported in the example files)

Code:

[Model]
[Pattern]
[Item]WELCOME TO SYNBOT[/Item]
[/Pattern]
[Response xml:space="preserve"]
[If User="Name" Value=""][Var Think:Set="Temp"]NameusernotOK[/Var][/If]
[Else][Var Think:Set="Temp"]NameuserOK[/Var][/Else]
[Goto xml:space="preserve"]WELCOME TO SYNBOT [Var Get="Temp" /] [User Get="Userlanguage" /][/Goto]
[/Response]
[/Model]

[Model]
[Pattern]
[Item]WELCOME TO SYNBOT NAMEUSEROK FR[/Item]
[/Pattern]
[Response]
[Random Get="Welcome_fr" /]
[/Response]
[/Model]

[Model]
[Pattern]
[Item]WELCOME TO SYNBOT NAMEUSEROK EN[/Item]
[/Pattern]
[Response xml:space="preserve"]
[Random Get="Welcome_en" /]
[/Response]
[/Model]

[Model]
[Pattern]
[Item]WELCOME TO SYNBOT NAMEUSERNOTOK FR[/Item]
[/Pattern]
[Response xml:space="preserve"]
[Label]:Setusername-fr[/Label]
[User Think:Set="bot_event_response"][Random Get="Bienvenue_mess_fr" /]_[Random Get="Presentation_Name_fr_1" /] je suis [Bot Get="robottypefr" /] MAIS [Random Get="Je_ne_connais_pas_ton_nom_fr" /][/User]
[/Response]
[/Model]

[Model]
[Pattern]
[Item]WELCOME TO SYNBOT NAMEUSERNOTOK EN[/Item]
[/Pattern]
[Response xml:space="preserve"]
[Label]:Setusername-en[/Label]
[User Think:Set="bot_event_response"][Random Get="Bienvenue_mess_en" /]_[Random Get="Presentation_Name_en_1" /] I'm [Bot Get="robottypeen" /] but [Random Get="Je_ne_connais_pas_ton_nom_en" /][/User]
[/Response]
[/Model]

[Model]
[Pattern]
[Item]JE M'APPELLE *~2[/Item]
[Item]TU PEUX M'APPELER *~2[/Item]
[Item]MON NOM EST *~2[/Item]
[Item]MON PRÉNOM EST *~2[/Item]
[Item]APPELLE MOI *~2[/Item]
[Item]*~2[/Item]
[/Pattern]
[Previous]:Setusername-fr[/Previous]
[Response xml:space="preserve"]
[User Think:Set="Name"][Match /][/User]
[Random]
[Item][Random Get="Presentation_response_deb_fr_1" /]_[Random Get="Presentation_response_fin_fr" /][/Item]
[Item][Random Get="Presentation_response_deb_fr" /] Je T'APPELERAI MAINTENANT [Match /][/Item]
[Item][Random Get="Presentation_response_deb_fr" /] Je T'APPELERAI [Match /] à partir de maintenant[/Item]
[/Random]
[/Response]
[/Model]

[Model]
[Pattern]
[Item]MY NAME IS *~2[/Item]
[Item]YOU CAN CALL ME *~2[/Item]
[Item]CALL ME *~2[/Item]
[Item]*~2[/Item]
[/Pattern]
[Previous]:Setusername-en[/Previous]
[Response xml:space="preserve"]
[User Think:Set="Name"][Match /][/User]
[Random]
[Item][Random Get="Presentation_response_deb_en_1" /]_[Random Get="Presentation_response_fin_en" /][/Item]
[Item][Random Get="Presentation_response_deb_en" /] I will call you [Match /][/Item]
[Item][Random Get="Presentation_response_deb_en" /] I will call you [Match /] now[/Item]
[/Random]
[/Response]
[/Model]


For example for a new userid "John"
User-inserted image

User-inserted image

Before Stop Bot event

You can configure a Bot Event which will be raised just after the Bot stop Command and just before the session finished.
Default is BOT STOP EVENT

Below is the SIML models used in the example files to manage the Before Stop Event in sending to the user a Random Bye Message Response customized depending on the User language used.
User-inserted image

Code:

[Event]
[Pattern]
[Item]BOT STOP EVENT[/Item]
[/Pattern]
[Response xml:space="preserve"]
[Random Get="Bye_Bye_{Bind User:Userlanguage}" /]
[/Response]
[/Event]

Code:

[Random Name="Bye_Bye_fr"]
[Item xml:space="preserve"]AU REVOIR [User Get="Name" /] A BIENTOT[/Item]
[Item xml:space="preserve"]AU REVOIR et A BIENTOT [User Get="Name" /][/Item]
[Item xml:space="preserve"][Random Get="Bye_bye_part1_fr" /]_[Random Get="Bye_bye_part2_fr" /][/Item]
[Item xml:space="preserve"][Random Get="Bye_bye_part1_fr" /]_[Random Get="Bye_bye_part2_fr" /]_[User Get="Name" /][/Item]
[/Random]
[Random Name="Bye_bye_part1_fr"](AU PLAISIR de te revoir bientot |REVIENS VITE me voir)[/Random]
[Random Name="Bye_bye_part2_fr"](tu me manques déjà|_)[/Random]
[Random Name="Bye_Bye_en"]
[Item xml:space="preserve"][Random Get="Bye_end_en" /]_[User Get="Name" /]_[Random Get="See_You_next" /][/Item]
[Item xml:space="preserve"][Random Get="Bye_end_en" /]_[Random Get="See_You_next" /]_[User Get="Name" /][/Item]
[Item xml:space="preserve"][User Get="Name" /]_[Random Get="Bye_end_en" /]_[Random Get="See_You_next" /][/Item]
[/Random]
[Random Name="Bye_end_en"](Bye|Bye Bye|Pleased to meet you|Glad to meet you|It was a pleasure)[/Random]
[Random Name="See_You_next"]
[Item xml:space="preserve"]See You [Random Get="Bye_bye_part3_en" /][/Item]
[Item xml:space="preserve"]I Miss You[/Item]
[Item xml:space="preserve"]I Miss You already[/Item]
[/Random]
[Random Name="Bye_bye_part3_en"](next|soon|later|another time|_)[/Random]



Bot no match Message

You can configure a Message which will be automatically sent to the Bot when the plugin receive from the Bot an Empty answer Response.
Default is BOT NO RESPONSE MESSAGE.

If there are no Match Patterns for a user query , Bot variable "Empty-Response" can be set a message value.
The message value Set will be returned as Response to the User.
This Bot mechanism is also activated when the last response to a user request is Empty - It means Response of the last model activated but Response sent to the plugin is Response of the first Model activated ( It can be confusing with several GOTO ....)
So you can decide of mechanism to use in setting or not a response in the last model activated in a GOTO chaining.

The plugin will consider that there's No Match when normal Bot Response message(Response of the first model activated) is empty and when variable used to store the Bot Response (User variable bot_event_response) is empty.
In this case, if a Bot No Match Message is configured , it is send as request to the Bot.
This mechanism allow to configure in the Bot no Match Message Model a customized message to be sent to the User in case of a Bot Empty Response (Generally due to an error in user input)

Below is the SIML models used in the example files to manage the Bot No Response Message with customization depending on the User language used.

Code:

[Model]
[Pattern]
[Item]BOT NO RESPONSE MESSAGE[/Item]
[/Pattern]
[Response xml:space="preserve"]
[Think]
[Var Set="Can_not_answer"]Can_not_answer_[User Get="Userlanguage" /][/Var]
[Var Set="Sorry"]Sorry_[User Get="Userlanguage" /][/Var]
[User Think:Set="bot_event_response"]
[Random]
[Item][Random Get="{Bind Var:Can_not_answer}" /][/Item]
[Item][Random Get="{Bind Var:Can_not_answer}" /]_[User Get="Name" /][/Item]
[Item][Random Get="{Bind Var:Sorry}" /]_[User Get="Name" /]_[Random Get="{Bind Var:Can_not_answer}" /][/Item]
[Item][Random Get="{Bind Var:Sorry}" /]_[Random Get="{Bind Var:Can_not_answer}" /][/Item]
[/Random]
[/User]
[/Think]
[/Response]
[/Model]

Code:

[Random Name="Can_not_answer_fr"](Je ne sais pas répondre à ta demande|Je ne sais pas répondre)[/Random]
[Random Name="Can_not_answer_en"](I can't respond to your request|I can't answer to your request|I can't answer|I can't respond)[/Random]
[Random Name="Sorry_fr"](Je suis désolé|Désolé|_)[/Random]
[Random Name="Sorry_en"](I'm sorry|Sorry| )[/Random]