Hello Everyone,
I am getting an error: Could not determine parameter type of 'box yada yada yada' at line yada.
Here are the two functions.
function DrawButton(tb as integer)
box allbuttons(tb).brect.rleft,allbuttons(tb).brect.rtop,allbuttons(tb).brect.rright,allbuttons(tb).brect.rbottom, _
allbuttons(tb).bcolor,allbuttons(tb).bcolor,allbuttons(tb).bcolor,allbuttons(tb).bcolor
ENDFUNCTION
function DrawSquare(x as integer,y as integer)
box allsquares(x,y).brect.rleft,allsquares(x,y).brect.rtop,allsquares(x,y).brect.rright,allsquares(x,y).brect.rbottom, _
allsquares(x,y).bcolor,allsquares(x,y).bcolor,allsquares(x,y).bcolor,allsquares(x,y).bcolor
ENDFUNCTION
They are very simple, one draws a box for one thing I want, the other draws a box for the other thing I want all based on arrays. If I leave one out (along with associated code) it works perfectly. If I have both of them in, it gives me that error. Does dbpro not like 2 box commands in the same code????
background info: multiple udts....actually, here is the whole thing so you guys can take a look. Not much in commenting yet so ask if there is any confusion...the functions in question are the last 2 (played around with positioning to figure out it was the 2 together that made a difference...)
Rem Project: flood game
Rem Created: Sunday, September 04, 2011
Rem ***** Main Source File *****
rem create custom types to hold info
type Rect
rLeft as integer
rRight as integer
rTop as integer
rBottom as integer
endtype
type mButton
bRect as rect
Pressed as integer
bcolor as dword
Caption as string
ColorPressed as dword
endtype
type mSquare
bRect as rect
bcolor as dword
prevcolor as dword
endtype
type mGameBoard
bRect as rect
endtype
rem create some variables to hold stuff
rem arrays are created in the InitialMe function after user input!!!!
NumColors as integer
XNum as integer
YNum as integer
GameStarted as integer
StartRe as mButton
TimePast as dword
BlockWidth as integer
BlockHeight as integer
tsquares as integer
ThisBoard as mGameboard
TurnCounter as integer
rem intialize the startup variables and such
randomize timer()
gamestarted = 0
do
if escapekey() = 1 then end
if GameStarted = 0 then InitialMe()
GameStarted = 1
sync
LOOP
function ChangeColors(newcolor as dword)
for i = 1 to xnum
for j = 1 to ynum
rem is this the first square? - everything is based off of this!!!
if i = 1 and j = 1
rem if the squares to the rigth or down are the same color, change them and set the previous color flag
if allsquares(2,1).bcolor = allsquares(1,1).bcolor then allsquares(2,1).prevcolor = allsquares(2,1).bcolor: allsquares(2,1).bcolor = newcolor
if allsquares(1,2).bcolor = allsquares(1,1).bcolor then allsquares(1,2).prevcolor = allsquares(1,2).bcolor: allsquares(1,2).bcolor = newcolor
allsquares(1,1).bcolor = newcolor
ENDIF
rem if it isn't the first square, has it already been changed?
if allsquares(i,j).prevcolor <> 0
rem if it has been changed, is it in the first column?
if allsquares((i-1),j).bcolor = allsquares(i,j).prevcolor then allsquares((i-1),j).prevcolor = allsquares((i-1),j).bcolor:allsquares((i-1),j).bcolor = newcolor
if allsquares((i+1),j).bcolor = allsquares(i,j).prevcolor then allsquares((i+1),j).prevcolor = allsquares((i-1),j).bcolor:allsquares((i+1),j).bcolor = newcolor
ENDIF
next
NEXT
ENDFUNCTION
function ClearPrevColors()
for i = 1 to xnum
for j = 1 to ynum
allsquares(i,j).prevcolor = 0
NEXT
NEXT
ENDFUNCTION
function ButtonAction(BNum as integer)
ENDFUNCTION
rem checks the current mouse location to see if it is on a button
function MouseCollision()
returned = 0
for i = 1 to 5
if mousex()>allButtons(i).brect.rleft then a = 1 else a = 0
if mousex()<allButtons(i).brect.rright then b = 1 else b = 0
if mousey()>allButtons(i).brect.rtop then c = 1 else c = 0
if mousey()<allButtons(i).brect.rbottom then d = 1 else d = 0
returned = a+b+c+d
if returned = 4
returned = i
exit
else
returned = 0
ENDIF
NEXT i
ENDFUNCTION returned
function InitialMe()
cls
rem get user input for what they want their board to look like
input "How many colors in play? (less colors = easier game) "; NumColors
print "What grid size would you like to play? (smaller dimensions = easier game) "
input "X value: "; XNum
input "Y value: "; YNum
rem if XNum > 14 then xnum = 14
if xnum <= 0 then xnum = 1
rem if ynum > 14 then ynum = 14
if ynum <= 0 then ynum = 1
cls
rem !!!!!!!!!!!!!arrays used throughout the code!!!!!!!!!!!!!!!!!!!
buttonNum = 5 + numcolors
dim AllButtons(buttonNum) as mbutton
dim AllSquares(xnum,ynum) as msquare
dim RandColors(NumColors)
rem ************************************************************************************************************************
rem set the initial playing board dimensions based on screen size, right half is playing area, left half is buttons and data
thisboard.brect.rleft = screen width()/2
thisboard.brect.rright = thisboard.brect.rleft+(SCREEN WIDTH()/2)
thisboard.brect.rtop = 10
thisboard.brect.rbottom = thisboard.brect.rtop+(SCREEN HEIGHT() - 20)
rem set the block size on the board
blockwidth = (SCREEN WIDTH()/2)/xnum
blockheight = (thisboard.brect.rbottom - thisboard.brect.rtop)/ynum
tsquares = xnum * ynum
rem setup the random colors and the board arrays
for a = 1 to Numcolors
randcolors(a) = rgb(rnd(254)+1,rnd(254)+1,rnd(254)+1)
NEXT
rem setup some initial variables to hold information
x=1
y=1
leftmarker = thisboard.brect.rleft
topmarker = thisboard.brect.rtop
rem setup the data for the squares: color and placement
for b = 1 to tsquares
if x>xnum then x = 1: y=y+1: topmarker = topmarker+blockheight: leftmarker = thisboard.brect.rleft
allsquares(x,y).bcolor = randcolors(rnd((numcolors -1))+1)
allsquares(x,y).brect.rleft = leftmarker
allsquares(x,y).brect.rright = leftmarker+blockwidth
allsquares(x,y).brect.rtop = topmarker
allsquares(x,y).brect.rbottom = topmarker + blockheight
allsquares(x,y).prevcolor = 0
x=x+1
leftmarker = leftmarker+blockwidth
NEXT
rem draw the squares
for i = 1 to xnum
for j = 1 to ynum
drawSquare(i,j)
next
NEXT
rem **************************************************************************************************************************
rem setup left side of screen - buttons and data
rem setup start/reset button
allbuttons(1).pressed = 0
allbuttons(1).bcolor = rgb(140,157,188)
allbuttons(1).colorpressed = rgb(107,147,220)
allbuttons(1).caption = "New Game"
allbuttons(1).brect.rleft = 20
allbuttons(1).brect.rright = 100
allbuttons(1).brect.rtop = 20
allbuttons(1).brect.rbottom = 40
drawbutton(1)
ENDFUNCTION
function DrawButton(tb as integer)
box allbuttons(tb).brect.rleft,allbuttons(tb).brect.rtop,allbuttons(tb).brect.rright,allbuttons(tb).brect.rbottom, _
allbuttons(tb).bcolor,allbuttons(tb).bcolor,allbuttons(tb).bcolor,allbuttons(tb).bcolor
ENDFUNCTION
function DrawSquare(x as integer,y as integer)
box allsquares(x,y).brect.rleft,allsquares(x,y).brect.rtop,allsquares(x,y).brect.rright,allsquares(x,y).brect.rbottom, _
allsquares(x,y).bcolor,allsquares(x,y).bcolor,allsquares(x,y).bcolor,allsquares(x,y).bcolor
ENDFUNCTION
Thanks for the help, always appreciated!!!