A number guessing game for Bonzi Buddy.

It’s surprisingly easy to make VB scripts that use Microsoft Agent characters to interact with you. This one loads the Bonzi Buddy character file and has him play a little number guessing game with you. He’ll think of a number between 1 and 100 and then ask for your guess. He will then tell you if your guess is too high or too low. Don’t worry, he won’t spy on you or do anything from his bad old days.

intHighNumber = 100
intLowNumber = 1

strAgentPath = “C:\Windows\MSAgent\chars\Bonzi.acs”
Set objAgent = CreateObject(“Agent.Control.2”)

objAgent.Connected = TRUE
objAgent.Characters.Load strAgentName, strAgentPath
Set objCharacter = objAgent.Characters.Character(strAgentName)

Randomize
intNumber = Int((intHighNumber – intLowNumber + 1) * Rnd + intLowNumber)

objCharacter.Show
objCharacter.Speak “Guess the number!”

Do Until Cint(StrGuess)=IntNumber
strGuess = InputBox(“Enter your guess.”, _
“Guess the Number”)
if strGuess=”” then
objCharacter.Hide
Wscript.Quit
elseif Cint(strGuess) > IntNumber then
objCharacter.Speak “Too high.”
elseif Cint(strGuess)
objCharacter.Speak “Too low.”
end if

Loop

objCharacter.Speak “You guessed it!”
objCharacter.Play “Pleased”
objCharacter.Hide

Do While objCharacter.Visible = TRUE
Wscript.Sleep 250
Loop

For this script to work, you’ll need to download the Bonzi.acs file from this site and put the file in your \Windows\MSAgent\chars folder. If you still don’t like that cute little purple gorilla, you can easily change the script’s third line to load a different character such as Merlin, which should already be installed.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s