Visal Basic per Begginer

Page 199

Visual Basic Programming for the Absolute Beginner

180 The next step in using your agent is loading the inherit character ID of the character file into the agent control: Agent1.Characters.Load “CharacterID”, “Genie.acs”

This Load method essentially tells the control what character you will be working with. In this case, I’m explicitly telling the Agent1 control that I want to work with the genie character. TRA

P

Note that I’ve only specified the genie.acs filename as an argument. This implies that the genie.acs file exists in the directory where the agent program files exist. If you want the genie.acs file located in another directory, you have to explicitly tell the load method where it is, as in “c:\temp\Genie.acs”.

The last step in creating an agent control is to create a reference to the character object using the keyword set: Set myCharacter = Agent1.Characters(“CharacterID”)

Now we’re ready to rock and roll with the genie agent character. The first thing I might want to do is display the agent with the Show method: myCharacter.Show

Next I might want to play a specific character (genie) animation using the Play method: myCharacter.Play animation name

HIN

T

Each character has a number of animation clips that you will see when you build the agent program.

Last but not least, I might want the agent to say something. I can accomplish visible and audible speech with the Speak method: myCharacter.Speak string

When my program terminates, I want to free up any memory allocated to the agent with the following commands: Set myCharacter = Nothing Agent1.Characters.Unload “CharacterID”


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.