I've packed my block data for my minecraft clone project into following UDT:
type TElement
blocktype as word
meta1 as byte
meta2 as byte
endtype
It uses words and bytes in order to save memory which is pain in this type of games. However when I try to assign some values, like
chunk(x,y,z).blocktype = 6 it gives me error mentioned in topic. How can I fix it without changing variables into integers? It would be bad for my game and its memory if I'd do so.
//edit: Turns out that even after changing field types to integer it still doesn't work. Here's exact code I'm using:
type TElement
blocktype as word
meta1 as byte
meta2 as byte
powerlevel as byte
endtype
dim gamearea(255,255,255)
for x=0 to 255
for y=0 to 255
for z=0 to 255
gamearea(x,y,z).blocktype= 0
gamearea(x,y,z).meta1= 0
gamearea(x,y,z).meta2= 0
gamearea(x,y,z).powerlevel= 0
NEXT z
NEXT y
NEXT x
//edit: Just realized how dumb I was, Fix'd.
//edit: Now I have another problem. When building level with following loop:
for x=0 to 255
for y=0 to 255
for z=0 to 255
make object cube x+(y*255)+(z*255), 1
position object x+(y*255)+(z*255),x,y,z
NEXT z
NEXT y
NEXT x
after some time I get Invalid object number runtime error.
Mind you all those cubes won't be visible at once, those which have blocktype of 0 (air) will be hidden, for performance reasons but I need to prepare level somehow, needn't I?