I keep getting an error telling me that the object # is invalid on line 50 but I can not figure out why it should be getting an invalid object # as I have already gone through the array once before, and used a similar routine in a different form of the same sort of program without a problem. Obviously I am overlooking something that is most likely stupid. This is usually the case when I run into these head scratchers.
Maybe a fresh set of eyes can spot something I am missing?
NOTE: This is a part of the cloning minecraft with DBPRO challenge I made with my son and mentioned in another post. MC is written in JAVA, and I said I thought DBPRO could do it just as well or better.
RANDOMIZE TIMER()
SYNC ON
SYNC RATE 60
COLOR BACKDROP RGB(0,20,50)
INK RGB(255,255,255),0
CLS
set point light 0,-100,500,-100
GLOBAL MEDPAT AS STRING : MEDPAT = "C:\PROGRAM FILES\THE GAME CREATORS\DARK BASIC PROFESSIONAL\PROJECTS\CUBElife\MEDIA\"
GLOBAL FNA AS STRING : GLOBAL FNU AS INTEGER : GLOBAL x AS INTEGER : GLOBAL y AS INTEGER : x=0 : y=0 : GLOBAL z AS INTEGER : z=0
GLOBAL DIM BLOCKNAME(3) AS STRING : BLOCKNAME(1)="DIRT" : BLOCKNAME(2)="GLASS" : BLOCKNAME(3)="WATER"
GLOBAL DIM WB(20,20,20) AS INTEGER : GLOBAL DIM WBX(20) AS INTEGER : GLOBAL DIM WBY(20) AS INTEGER
GLOBAL DIM WBZ(20) AS INTEGER : GLOBAL COUNT AS INTEGER : COUNT = 0
FNU=1:FNA="DIRT":LOADOBJECT():WB(1,1,1)=1
FNU=2:FNA="GLASS":LOADOBJECT():WB(1,1,2)=2
FNU=3:FNA="WATER":LOADOBJECT():WB(1,1,3)=3:COUNT=3
FOR X=1 TO 20
Y=1
FOR Z = 4 TO 20
COUNT=COUNT+1
WB(X,Y,Z)=COUNT
R=rnd(2)+1
FNA=BLOCKNAME(R)
FNU=COUNT
INSTANCE OBJECT WB(X,Y,Z),rnd(2)+1
print "WB:"+str$(X)+"-"+str$(Y)+"-"+str$(Z)+" object #"+str$(COUNT):sync
NEXT Z
` NEXT Y
NEXT X
X=1:Y=1:Z=1
WBX(1)=0
FOR X = 2 TO 20
WBX(X)=WBX(X-1)+24
NEXT X
WBY(Y)=0
FOR Y = 2 TO 20
WBY(Y)=WBY(Y-1)+24
NEXT Y
WBZ(Z)=0
FOR Z = 2 TO 20
WBZ(Z)=WBZ(Z-1)+24
NEXT Z
FOR x=1 TO 20
FOR z=1 TO 20
print " OBJECT "+str$(WB(x,1,z))+" "
POSITION OBJECT WB(x,1,z),WBX(x),WBY(1),WBZ(z) `<-This is line 50
NEXT z
NEXT x
FOR X = 1 TO 20
FOR Z = 1 TO 20
Y=1
SHOW OBJECT WB(X,Y,Z)
NEXT Z
NEXT X
x=0:y=0:z=0
WHILE MOUSECLICK()=0
if inkey$()="4" then x=x+1
if inkey$()="6" then x=x-1
if x<0 then x=0
if x>100 then x=100
if inkey$()="7" then y=y+1
if inkey$()="9" then y=y-1
if y<0 then y=0
if y>100 then y=100
if inkey$()="1" then z=z+1
if inkey$()="3" then z=z-1
if z<0 then z=0
if z>100 then z=100
point camera x,y,z
SYNC
ENDWHILE
FOR X = 1 TO 20
FOR Z = 1 TO 20
Y=1
DELETE OBJECT WB(X,Y,Z)
NEXT Z
NEXT X
END
FUNCTION LOADOBJECT()
LOAD OBJECT MEDPAT+FNA+".3DS", FNU
ENDFUNCTION
[-=-=-=-=-=-=-=-=-=-=-=-=]
[Http://DIFS.Forumer.com ]
[-=-=-=-=-=-=-=-=-=-=-=-=]