Tic-Tac-Toe Scripting Help

This forum is meant for requesting technical support or reporting bugs.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

Tic-Tac-Toe Scripting Help

Postby cpkspikyhair » Sun Aug 10, 2008 6:01 pm

I have been trying to make a tic-tac-toe game for Windows. I have the full version of AM.

I thought I finally had it down, but I have a picture loading problem. I have 3 Procedures: CheckX, CheckO, and ResetSquares.

In the frame properties I have:

Code: Select all
sq1 = 0
sq2 = 0
sq3 = 0
sq4 = 0
sq5 = 0
sq6 = 0
sq7 = 0
sq8 = 0
sq9 = 0
turn = 1


Each "sq" corresponds to the square it represents. "Turn" is a variable that shows whose turn it is: 1 = X, 2 = O.

Under the 1st hotspot's properties, there is:

Code: Select all
Select Case True
Case ((turn = 1) And (sq1 = 0))
Hotspot(1).Picture = "x.bmp"
sq1 = 1
CheckX
turn = 2
Case ((turn = 2) And (sq1 = 0))
Hotspot(1).Picture = "o.bmp"
sq1 = 2
CheckO
turn = 1
Case (sq1 = 1)
MsgBox "Something is already there!"
Case (sq1 = 2)
MsgBox "Something is already there!"
End Select


If sq1 = 0, nothing is there. If sq1 = 1, x is there, and if sq1 = 2, o is there.

The error I get when I click on the hotspot is:

Type mismatch: 'Picture'

Can someone help?
PSPPC GameMaker!! Where you can find PSP and PC games up for download!
User avatar
cpkspikyhair
Games Page Administrator
 
Posts: 425
Joined: Thu Jun 28, 2007 1:49 pm
Location: On Mars (Yes There Is Water :) )

Postby Lyberodoggy » Sun Aug 10, 2008 6:13 pm

I don't know what the problem with the picture property is, but your select case is wrong (I think).
The select case works with a variable, not a value.
Ex:
Code: Select all
Select Case Variable
Case 1 'this means that variable=1
'actions
Case 2
...
Case 173938724093913196410387
End select
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby cpkspikyhair » Sun Aug 10, 2008 6:28 pm

Well, if it is wrong, can you give me a way to achieve the same effect?

I need to check two things at once, so I can't use If statements.

I am pretty sure I have used Select Case True before. I am 99% sure you can.
PSPPC GameMaker!! Where you can find PSP and PC games up for download!
User avatar
cpkspikyhair
Games Page Administrator
 
Posts: 425
Joined: Thu Jun 28, 2007 1:49 pm
Location: On Mars (Yes There Is Water :) )

Postby mercedes » Sun Aug 10, 2008 10:13 pm

I thought "True" meant that you can "see" it..so to speak.."False" means you can't..

Maybe I'm wrong..But the Select Case should be ..

Case 0--this means nothing happens
Case 1--this equals 1
Case 2--This equals 2

Edit..I see Lyberodoggy mentioned this already...:oops:

Also if its a picture mismatch..have you tried..

Code: Select all
Action.LoadAPicture hotspot(1),"x.bmp"


Sorry if this doesn't work and I wasted your time..:oops:

Also what do you have in the Global Procedures...might mean you have it differently in there and it doens't match to what you have in the select case..?

Peace
Adieux~
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby cpkspikyhair » Mon Aug 11, 2008 12:29 am

mercedes wrote:Also if its a picture mismatch..have you tried..

Code:
Action.LoadAPicture hotspot(1),"x.bmp"


It worked! Thank you so much for helping me!
PSPPC GameMaker!! Where you can find PSP and PC games up for download!
User avatar
cpkspikyhair
Games Page Administrator
 
Posts: 425
Joined: Thu Jun 28, 2007 1:49 pm
Location: On Mars (Yes There Is Water :) )

Postby mercedes » Mon Aug 11, 2008 12:34 am

No problem..:)




Peace~
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby ShadowHunter » Mon Aug 11, 2008 10:09 pm

Hi,

Did you check out my Tic-Tac-Toe script yet ?

http://www.shadowhunter.co.uk/index1.html (click VB-scripts in the left pane)

You might find it usefull :D

With best regards,

ShAdOwHuNtEr
User avatar
ShadowHunter
Forum Admin and Games Page admin
 
Posts: 1304
Joined: Fri Jun 06, 2003 10:37 pm
Location: Belgium

Postby cpkspikyhair » Tue Aug 12, 2008 2:23 am

I looked at it briefly, but I just wanted to make it a 2 player game. If I want to make it 1 player, I know who to ask :wink: .
PSPPC GameMaker!! Where you can find PSP and PC games up for download!
User avatar
cpkspikyhair
Games Page Administrator
 
Posts: 425
Joined: Thu Jun 28, 2007 1:49 pm
Location: On Mars (Yes There Is Water :) )


Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests