by Lee Qualls (1 Submission)
Category: Games
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 28th November 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Tic-Tac-Toe With MS Agents
API Declarations
Public who As Boolean
Public ActiveAgent As String
Dim Agent As IAgentCtlCharacterEx
Const DATAPATH = "Merlin.acs"
Const DATAPATH2 = "Genie.acs"
Const DATAPATH3 = "Peedy.acs"
Const DATAPATH4 = "Robby.acs"
Private Sub winner()
'accross
If (Image1 And Image2 And Image3) = imgx Then
Agent.Speak "game over! X Wins!"
MsgBox "Hit ok when ready to go on"
reload
Else
'accross
If (Image4 And Image5 And Image6) = imgx Then
Agent.Speak "game over! X Wins!"
MsgBox "Hit ok when ready to go on"
reload
Else
'accross
If (Image7 And Image8 And Image9) = imgx Then
Agent.Speak "game over! X Wins!"
MsgBox "Hit ok when ready to go on"
reload
Else
'diangle
If (Image3 And Image5 And Image7) = imgx Then
Agent.Speak "game over! X Wins!"
MsgBox "Hit ok when ready to go on"
reload
Else
'diangle
If (Image1 And Image5 And Image9) = imgx Then
Agent.Speak "game over! X Wins!"
MsgBox "Hit ok when ready to go on"
reload
Else
'down
If (Image1 And Image4 And Image7) = imgx Then
Agent.Speak "game over! X Wins!"
MsgBox "Hit ok when ready to go on"
reload
Else
'down
If (Image2 And Image5 And Image8) = imgx Then
Agent.Speak "game over! X Wins!"
MsgBox "Hit ok when ready to go on"
reload
Else
'down
If (Image3 And Image6 And Image9) = imgx Then
Agent.Speak "game over! X Wins!"
MsgBox "Hit ok when ready to go on"
reload
Else
'accross
If (Image1 And Image2 And Image3) = imgo Then
Agent.Speak "game over! O Wins!"
MsgBox "Hit ok when ready to go on"
reload
Else
'accross
If (Image4 And Image5 And Image6) = imgo Then
Agent.Speak "game over! O Wins!"
MsgBox "Hit ok when ready to go on"
reload
Else
'accross
If (Image7 And Image8 And Image9) = imgo Then
Agent.Speak "game over! O Wins!"
MsgBox "Hit ok when ready to go on"
reload
Else
'diangle
If (Image3 And Image5 And Image7) = imgo Then
Agent.Speak "game over! O Wins!"
MsgBox "Hit ok when ready to go on"
reload
Else
'diangle
If (Image1 And Image5 And Image9) = imgo Then
Agent.Speak "game over! O Wins!"
MsgBox "Hit ok when ready to go on"
reload
Else
'down
If (Image1 And Image4 And Image7) = imgo Then
Agent.Speak "game over! O Wins!"
MsgBox "Hit ok when ready to go on"
reload
Else
'down
If (Image2 And Image5 And Image8) = imgo Then
Agent.Speak "game over! O Wins!"
MsgBox "Hit ok when ready to go on"
reload
Else
'down
If (Image3 And Image6 And Image9) = imgo Then
Agent.Speak "game over! O Wins!"
MsgBox "Hit ok when ready to go on"
reload
Else
'no wins
If (Image1 <> Imgb And Image2 <> Imgb And Image3 <> Imgb And Image4 <> Imgb And Image5 <> Imgb And Image6 <> Imgb And Image7 <> Imgb And Image8 <> Imgb And Image9 <> Imgb) Then
Agent.Speak "game over! Cats Game!"
MsgBox "Hit ok when ready to go on"
reload
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End Sub
Private Sub reload()
X = True
Image1.Picture = Imgb.Picture
Image2.Picture = Imgb.Picture
Image3.Picture = Imgb.Picture
Image4.Picture = Imgb.Picture
Image5.Picture = Imgb.Picture
Image6.Picture = Imgb.Picture
Image7.Picture = Imgb.Picture
Image8.Picture = Imgb.Picture
Image9.Picture = Imgb.Picture
End Sub
Private Sub Command1_Click()
reload
End Sub
Private Sub Command2_Click()
Unload Form1
End Sub
Private Sub Form_Load()
Agent1.Characters.Load "Agent", DATAPATH
Set Agent = Agent1.Characters("Agent")
ActiveAgent = "Merlin"
Agent.Show
Agent.MoveTo 650, 300
Agent.Speak "Hello I am Merlin."
Agent.Speak "Welcome to Tic-Tac-Toe!"
Agent.Speak "X goes first."
X = True
End Sub
Private Sub Image1_Click()
If X = True Then
If Image1.Picture = imgo.Picture Then
Agent.Speak "You can not do that!"
Else
Image1.Picture = imgx.Picture
Agent.Speak "O it your turn."
X = False
End If
Else
If Image1.Picture = imgx.Picture Then
Agent.Speak "You can not do that!"
Else
Image1.Picture = imgo.Picture
Agent.Speak "X it your turn."
X = True
End If
End If
winner
End Sub
Private Sub Image2_Click()
If X = True Then
If Image2.Picture = imgo.Picture Then
Agent.Speak "You can not do that!"
Else
Image2.Picture = imgx.Picture
Agent.Speak "O it your turn."
X = False
End If
Else
If Image2.Picture = imgx.Picture Then
Agent.Speak "You can not do that!"
Else
Image2.Picture = imgo.Picture
Agent.Speak "X it your turn."
X = True
End If
End If
winner
End Sub
Private Sub Image3_Click()
If X = True Then
If Image3.Picture = imgo.Picture Then
Agent.Speak "You can not do that!"
Else
Image3.Picture = imgx.Picture
Agent.Speak "O it your turn."
X = False
End If
Else
If Image3.Picture = imgx.Picture Then
Agent.Speak "You can not do that!"
Else
Image3.Picture = imgo.Picture
Agent.Speak "X it your turn."
X = True
End If
End If
winner
End Sub
Private Sub Image4_Click()
If X = True Then
If Image4.Picture = imgo.Picture Then
Agent.Speak "You can not do that!"
Else
Image4.Picture = imgx.Picture
Agent.Speak "O it your turn."
X = False
End If
Else
If Image4.Picture = imgx.Picture Then
Agent.Speak "You can not do that!"
Else
Image4.Picture = imgo.Picture
Agent.Speak "X it your turn."
X = True
End If
End If
winner
End Sub
Private Sub Image5_Click()
If X = True Then
If Image5.Picture = imgo.Picture Then
Agent.Speak "You can not do that!"
Else
Image5.Picture = imgx.Picture
Agent.Speak "O it your turn."
X = False
End If
Else
If Image5.Picture = imgx.Picture Then
Agent.Speak "You can not do that!"
Else
Image5.Picture = imgx.Picture
Agent.Speak "X it your turn."
X = True
End If
End If
winner
End Sub
Private Sub Image6_Click()
If X = True Then
If Image6.Picture = imgo.Picture Then
Agent.Speak "You can not do that!"
Else
Image6.Picture = imgx.Picture
Agent.Speak "O it your turn."
X = False
End If
Else
If Image6.Picture = imgx.Picture Then
Agent.Speak "You can not do that!"
Else
Image6.Picture = imgo.Picture
Agent.Speak "X it your turn."
X = True
End If
End If
winner
End Sub
Private Sub Image7_Click()
If X = True Then
If Image7.Picture = imgo.Picture Then
Agent.Speak "You can not do that!"
Else
Image7.Picture = imgx.Picture
Agent.Speak "O it your turn."
X = False
End If
Else
If Image7.Picture = imgx.Picture Then
Agent.Speak "You can not do that!"
Else
Image7.Picture = imgo.Picture
Agent.Speak "X it your turn."
X = True
End If
End If
winner
End Sub
Private Sub Image8_Click()
If X = True Then
If Image8.Picture = imgo.Picture Then
Agent.Speak "You can not do that!"
Else
Image8.Picture = imgx.Picture
Agent.Speak "O it your turn."
X = False
End If
Else
If Image8.Picture = imgx.Picture Then
Agent.Speak "You can not do that!"
Else
Image8.Picture = imgo.Picture
Agent.Speak "X it your turn."
X = True
End If
End If
winner
End Sub
Private Sub Image9_Click()
If X = True Then
If Image9.Picture = imgo.Picture Then
Agent.Speak "You can not do that!"
Else
Image9.Picture = imgx.Picture
Agent.Speak "O it your turn."
X = False
End If
Else
If Image9.Picture = imgx.Picture Then
Agent.Speak "You can not do that!"
Else
Image9.Picture = imgo.Picture
Agent.Speak "X it your turn."
X = True
End If
End If
winner
End Sub
Private Sub showeagent1_Click()
Agent1.Characters.Unload "Agent"
Agent1.Characters.Load "Agent", DATAPATH2
Set Agent = Agent1.Characters("Agent")
Agent.Show
Agent.MoveTo 650, 300
Agent.Speak "Hello I am Genie"
End Sub
Private Sub showeagent2_Click()
Agent1.Characters.Unload "Agent"
Agent1.Characters.Load "Agent", DATAPATH
Set Agent = Agent1.Characters("Agent")
Agent.Show
Agent.MoveTo 650, 300
Agent.Speak "Hello I am Merlin."
End Sub
Private Sub showeagent3_Click()
Agent1.Characters.Unload "Agent"
Agent1.Characters.Load "Agent", DATAPATH3
Set Agent = Agent1.Characters("Agent")
Agent.Show
Agent.MoveTo 630, 300
Agent.Speak "Hello I am Peedy."
End Sub
Private Sub showeagent4_Click()
Agent1.Characters.Unload "Agent"
Agent1.Characters.Load "Agent", DATAPATH4
Set Agent = Agent1.Characters("Agent")
Agent.Show
Agent.MoveTo 650, 300
Agent.Speak "Hello I am Robby."
End Sub