Synbot Plugin Tutorial - interface to Syn Bot Software

Step 6 : Working with SIML Events

SIML Events allows to trigger special evaluation of responses in SIML files

In SIML files you define an event with the EVENT tag

 [Event]
      [Pattern]TEST-EVENT[/Pattern]
      [Response]Event Raised.[/Response]
 [/Event]

In SIML files , you can trigger the event TEST-EVENT with the RAISE tag :

[Model]
  [Pattern]RAISE EVENT[/Pattern]
  [Response]
    [Raise]test-event[/Raise]
  [/Response]
[/Model]

Response of the bot to user message "Raise event" will be "Event Raised" Response of the bot will be sent and managed by the plugin as the response to a normal query

Raising SIML events in EZ Builder scripts

You can raise SIML events in EZ Builder scripts :

Raisebotevent("bot event id")

Or

$Botevent= "bot event id"
ControlCommand("Synbot Plugin", Raiseevent)

Where bot event id is the pattern of the SIML event

Raisebotevent("test-event")

Will raise the test-event event. Response of the bot will be "Event Raised"

See for example User Input recognition for "What do you See" which call an EZBuilder Script with use of Cognitive Vision Plugin.

[Case Value="CAMERA_RECOGNITION"][Var Set="EZscript"]Start Bing Vision Recognition[/Var][Var Set="mess1"]|Waiting for Bing Vision recognition[/Var][/Case]

Synbot Event is set in this script .

if (!$IsCameraActive)
  ControlCommand("Camera", CameraStart)
  sleep(1000)
endif
ControlCommand("Cognitive Vision", Detect)
sleep(500)
$botevent = "Return from Bing Vision Event"
ControlCommand("Synbot Plugin", Raiseevent)

Model is coded for this event in order to process Cognitive vision plugin answer (especially translate it for french language).

[Event]
      [Pattern]
        [!--Event set by EZscript Script in script Manager Start Bing Vision Recognition after execution of Bing Vision recognition
     Only in english - so need to be modified to include the [x:Translate] which is in testing
     Need to be also modified if Bing result are Empty
     --]
        [Item]RETURN FROM BING VISION EVENT[/Item]
      [/Pattern]
      [Response xml:space="preserve"]
 	   [Think]
        [Var Set="Visiondescription"][x:EZvar Get="VisionDescription" /][/Var]
        [Var Set="Visionconfidence"][x:EZvar Get="VisionConfidence" /][/Var]
        [Var Set="Visiondescriptionfr"][x:Translate][Var Get="Visiondescription" /][/x:Translate][/Var]
        [If Var="Visionconfidence" Not="0"]
	        [Switch User="Userlanguage"]
	            [Case Value="fr"]
	                  [Var Set="Visiondescription"][x:Translate][Var Get="Visiondescription" /][/x:Translate][/Var]
	            	  [Var Set="Temp"] Je vois [/Var][Var Set="Temp1"]avec une certitude de [/Var][Var Set="Temp2"] pourcent[/Var][/Case]
	            [Case Value="en"]
	            [Var Set="Temp"]I See [/Var][Var Set="Temp1"]with a level of confidence of [/Var][Var Set="Temp2"] percent[/Var][/Case]
	         [/Switch]
	          [Var Set="Messresponse"][Var Get="Temp" /]_[Var Get="Visiondescription" /]_[Var Get="Temp1" /]_[Var Get="Visionconfidence" /][Var Get="Temp2" /][/Var]
         [/If]
         [Else]
         	 [Switch User="Userlanguage"]
	            [Case Value="fr"][Var Set="Messresponse"]Je ne peux rien voir[/Var][/Case]
	            [Case Value="en"][Var Set="Messresponse"]I cannot see anything[/Var][/Case]
	         [/Switch]
         [/Else]
        [/Think]
       [Var Get="Messresponse" /]
      [/Response]
    [/Event]

Below the result ....

User-inserted image


ARC Pro

Upgrade to ARC Pro

Unleash your robot's full potential with the cutting-edge features and intuitive programming offered by Synthiam ARC Pro.