PDA

View Full Version : data file produces runtime error



efly2020
26-10-2008, 18:02
Please help.
I can not find what is wrong with this data file which produces an error.

----------------------------------------------------------------------------------
' data.inc
' pieces are pictured flipped horizontally
%pieces_max = 7 ' to what is used in the game
%segments_max = 4
%coords_max = 2

dim pieces_data(%coords_max, %segments_max, %pieces_max) as long
Array Assign pieces_data = _
_
0, 0 , 1, 0 , 0,-1 , 1,-1 , _ ' 00 1
_ ' 00
-2, 0 , -1, 0 , 0, 0 , 1, 0 , _ ' 0000 2
-1, 0 , 0, 0 , 1, 0 , 0,-1 , _ ' 000 3
_ ' 0
-1, 0 , 0, 0 , 0,-1 , 1,-1 , _ ' 00 4
_ ' 00
0, 0 , 1, 0 , -1,-1 , 0,-1 , _ ' 00 5
_ ' 00
-1, 0 , 0, 0 , 1, 0 , 1,-1 , _ ' 000 6
_ ' 0
-1, 0 , 0, 0 , 1, 0 , -1,-1 ' 000 7
' 0

dim extra_data(%segments_max, %pieces_max) as long
Array Assign extra_data = _
_
0, 0, 0, 0, _ ' 1
0, 0, 0, 0, _ ' 2
0, 0 0, 0, _ ' 3
0, 0, 0, 0, _ ' 4
0, 0, 0, 0, _ ' 5
0, 0, 0, 0, _ ' 6
0, 0, 0, 0 ' 7
----------------------------------------------------------------------------------
' produces runtime error - Unknown Keyword, Token: extra_data

USES "Console"

#INCLUDE once "data.inc"

dim jk, jr as long

Console_WriteLine

for jk = 1 to %pieces_max
for jr = 1 to %segments_max
Console_Write FORMAT$(pieces_data(1, jr, jk)," 0; 0"),",", _
FORMAT$(pieces_data(2, jr, jk)," 0; 0")," "
next
Console_WriteLine
next

Console_WriteLine

for jk = 1 to %pieces_max
for jr = 1 to %segments_max
Console_Write FORMAT$(extra_data(jr, jk),"0"),", "
next
Console_WriteLine
next

Console_WriteLine

Console_WaitKey

Michael Clease
26-10-2008, 19:49
Line 3 has a missing comma and I cleaned up your presentation.


0, 0 0, 0, _ ' 3



USES "Console"

#INCLUDE once "data.inc"

dim jk, jr as long

Console_WriteLine

for jk = 1 to %pieces_max
for jr = 1 to %segments_max
Console_Write FORMAT$(pieces_data(1, jr, jk)," 0;-0; 0"),",", _
FORMAT$(pieces_data(2, jr, jk)," 0;-0; 0")," "
next
Console_WriteLine
next

Console_WriteLine

for jk = 1 to %pieces_max
for jr = 1 to %segments_max
Console_Write FORMAT$(extra_data(jr, jk)," 0;-0; 0"),","
next
Console_WriteLine
next

Console_WriteLine

Console_WaitKey

'----------------------------------------------------------------------------------
' data.inc
' pieces are pictured flipped horizontally
%pieces_max = 7 ' to what is used in the game
%segments_max = 4
%coords_max = 2

dim pieces_data(%coords_max, %segments_max, %pieces_max) as long
Array Assign pieces_data = _
0, 0, 1, 0, 0,-1, 1,-1, _ ' 000 1
-2, 0,-1, 0, 0, 0, 1, 0, _ ' 000 2
-1, 0, 0, 0, 1, 0, 0,-1, _ ' 000 3
-1, 0, 0, 0, 0,-1, 1,-1, _ ' 000 4
0, 0, 1, 0,-1,-1, 0,-1, _ ' 000 5
-1, 0, 0, 0, 1, 0, 1,-1, _ ' 000 6
-1, 0, 0, 0, 1, 0,-1,-1 ' 000 7

dim extra_data(%segments_max, %pieces_max) as long
Array Assign extra_data = _
0, 0, 0, 0, _ ' 1
0, 0, 0, 0, _ ' 2
0, 0, 0, 0, _ ' 3
0, 0, 0, 0, _ ' 4
0, 0, 0, 0, _ ' 5
0, 0, 0, 0, _ ' 6
0, 0, 0, 0 ' 7
'----------------------------------------------------------------------------------

efly2020
26-10-2008, 20:19
That fixed the problem.

Thanks very much for your help