Speaking the Message

Now that I have my collection of Agent characters and a combo box filled with Agent names, I let the user choose any one of these and then click the command button. This triggers the Click event you see in Listing 14.3.

Listing 14.3: Command1_Click Event in Hello Jill

Private Sub Command1_Click()
Agent1.Characters.Character(Combo1.Text).Show
Agent1.Characters.Character(Combo1.Text).Speak Text1.Text
Agent1.Characters.Character(Combo1.Text).Hide
End Sub

I start the routine by showing the character specified by the user. Then I use the Speak method to have the character speak the words in the text box. Finally, I Hide the character until the next time I want to use him.

© 1998 SYBEX Inc. All rights reserved.