共用方式為


Wait 方法

[Microsoft代理程式從 Windows 7 開始已被取代,而且可能無法在後續版本的 Windows 中使用。]

描述

讓指定字元的動畫佇列等到指定的動畫要求完成為止。

語法

代理程式**。字元 (“CharacterID]。Wait**要求

部分 描述
要求 指定特定動畫 Request 物件。

 

言論

只有在您支援多個 (同時) 字元且嘗試排序字元互動時,才使用這個方法。 (對於單一字元,每個動畫要求都會循序播放--在上一個要求完成之後。如果您有兩個字元,而且您想要字元的動畫要求等到其他字元的動畫完成,請將 Wait 方法設定為另一個字元的動畫 Request 物件。 若要指定要求參數,您必須建立變數,並指派您想要中斷的動畫要求:

   Dim GenieRequest 
   Dim RobbyRequest 
   Dim Genie 
   Dim Robby 

   Sub window_Onload

   Agent1.Characters.Load "Genie", "https://agent.microsoft.com/characters/v2/genie/genie.acf"
   Agent1.Characters.Load "Robby", "https://agent.microsoft.com/characters/v2/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

您也可以使用特定的動畫要求,直接呼叫 Wait 來簡化程序代碼。

   Robby.Wait Genie.Play "GestureRight"

這可避免必須明確宣告 Request 物件。