Wait Method

Description

Causes the animation queue for the specified character to wait until the specified animation request completes.

Syntax

agent.Characters ("CharacterID").Wait Request

Part Description
Request A Request object specifying a particular animation. To set this parameter you must assign the Request object variable in your code.

Remarks

Use this method only when you support multiple (simultaneous) characters and are trying to sequence the interaction of characters (as a single client). (For a single character, each animation request is played sequentially--after the previous request completes.) If you have two characters and you want a character's animation request to wait until the other character's animation completes, set the Wait method to the other character's animation Request object, as shown in the following example:

    Dim GenieRequest 
    Dim RobbyRequest 
    Dim Genie 
    Dim Robby 

    Sub window_Onload

    Agent1.Characters.Load "Genie", _ 
        "http://agent.microsoft.com/characters/genie/genie.acf"
    Agent1.Characters.Load "Robby", _
        "http://agent.microsoft.com/characters/robby/robby.acf"

    Set Genie = Agent1.Characters("Genie")
    Set Robby = Agent1.Characters("Robby")

    Genie.Get "State", "Showing"
    Robby.Get "State", "Showing"

    Genie.Get "Animation", "Announce, AnnounceReturn, Pleased, _ 
        PleasedReturn"
    
    Robby.Get "Animation", "Confused, ConfusedReturn, Sad, SadReturn"

    Set Genie = Agent1.Characters ("Genie")
    Set Robby = Agent1.Characters ("Robby")

    Genie.MoveTo 100,100
    Genie.Show

    Robby.MoveTo 250,100
    Robby.Show

    Genie.Play "Announce"
    Set GenieRequest = Genie.Speak ("Why did the chicken cross the road?")
    
    Robby.Wait GenieRequest
    Robby.Play "Confused"
    Set RobbyRequest = Robby.Speak ("I don't know. Why did the chicken _
        cross the road?")
    
    Genie.Wait RobbyRequest
    Genie.Play "Pleased"
    Set GenieRequest = Genie.Speak ("To get to the other side.")
    
    Robby.Wait GenieRequest
    Robby.Play "Sad"
    Robby.Speak "I never should have asked."

    End Sub

--------------------------------------------------------