Scenario Description Language Q

about Qtutorialdownloadpublicationscontact us

<Japanese>

example

defcue defaction

defcue and defaction define a cue and an action, respectively.
Parameters followed by respective cues and actions need to have the types defined by defparameter. "In" should be specified for providing an agent with a parameter value in a scenario, and "out" should be specified for the agent to return a value.

(defcue ?receive_selection (:selection in))
(defcue ?receive_text (:text out))

(defaction gesture (:animation in))

	    

defagent

defagent defines an agent.

(defagent Merlin
  :scenario scenario_merlin
  :location '(20 40)
  :shape '("Merlin.acs"))
	    

defscenario

defscenario describes a scenario for an agent.
A local variable in a scenario can be defined by "let". A state can be defined in the form of a scene in a scenario. Here, a scene named scene1 is defined.

(defscenario scenario_merlin (&pattern ($x #f) &aux (time #f))
 (introduction
  (#t
   (!fly :to_coordinate '(50 300))
   (!speak :sentence "I am Merlin.")
   (!speak :sentence "I show you Yomiuri Shinbun Web page.")
   (!display :url "http://www.yomiuri.co.jp")
   (!speak :sentence "What are you interested in now?")
   (!request_selection :selection_list '("What are you interested in now?"
                                         "World Cup2002"
                                         "Others"))
   (go asking_question)))
	    

Guarded Command

A guarded command can sense multiple cues in parallel. Multiple cues arranged by a guard clause are sensed in parallel by an agent. The agent then selects one of the approved cues to execute the following action. Here are descriptions of the correspondence to user's choices from the list displayed by an agent in scene1. The agent does not perform anything and keeps waiting until the user makes a choice. However, a guard in the head of scene can be omitted as follows;

  (asking_question
   ((?receive_selection :selection 0)
    (!display :url "http://www.yomiuri.co.jp/attack/index.htm")
    (!speak :sentence "Do you support the United States for attacking against Afghanistan?")
    (!request_text :sentence  "Input here.")
    (go About_Afghanistan))
   ((?receive_selection :selection 1)
    (!display :url "http://www.yomiuri.co.jp/sports/wcup2002/main.htm")
    (!speak :sentence "Which country do you think will win the World Cup?")
    (!request_text :sentence  "Input here")
    (go About_WorldCup))
   ((?receive_selection :selection 2)
    (!speak :sentence "Then, what are you interested in? Input in the textbox.")
    (!request_text :sentence "Input what you are interested in here.")
    (go About_else)))
	    

Pattern variable

Pattern variables are used when substituting the sensed result in a cue for a variable. Pattern variables are variables starting with $. Here, user's input is substituted for pattern variable $x by cue ?receive_text.

  (About_WorldCup
   ((?receive_text :text $x)
    (cond 
     ((all-keywords? '("France") $x)
      (!speak :sentence "They are good as I thought. I also believe that France will win."))
     ((all-keywords? '("Brasil") $x)
      (!speak :sentence "They appears to be having a tough time in the preliminaries."))
     ((all-keywords? '("Italy") $x)
      (!speak :sentence "They appears to be having a tough time in the preliminaries.")
      (!request_text :sentence "Input here.")
      (go About_Italy))
     ((all-keywords? '("England") $x)
      (!speak :sentence "Owen is in excellent shape now."))
     (else
      (!speak :sentence (string-append "What makes you think that" $x "will win?"))
      (!request_text :sentence  "Input here.")
      (go About_another_country)))))
	    

 

Copyright(C) Ishida lab. All rights researved.