Why am I getting an out of dim array with this code? It seems that the Array is never actually created but I am at a loss as to why now. I am at the end of my tether now. I am just trying to test something and want to create a bunch of items on screen but cant even get past this blasted out of dim array. What is crazy is in my main app everything works perfectly but I cannot get this damned error worked out. (I know nothing will show on screen as thats next.
Mike
DIM Creature[IdNumb][5]
begin:
GOSUB NewBeasts
SHOWSCREEN
GOTO begin
// ------------------------------------------------------------- //
// --- NEWBEASTS ---
// ------------------------------------------------------------- //
SUB NewBeasts:
ID = 0
FOR Beast = 0 TO 50
Creature[IdNumb][0] = ID
Creature[IdNumb][1] = RND(10)
Creature[IdNumb][2] = RGB(RND(255),RND(255),RND(255))
NEXT
ENDSUB // NEWBEASTS
Because IdNumb=0 when you declared the array.
You must declare this value to be >=2
Since IDNumb=0 when you start, this is what you are declaring:
DIM Creature[0][5]
This is not correct.
Declare minimum 2 dimension array:
DIM array[2][2]
This creates 2 slots with 2 positions in them.
2x2 array is something like this:
00
01
10
11
I think I need to go lie down. How stupid can I be. :zzz: The idiot thing is I know this. I'm getting too old. :bed:
Thanks for pointing it out.
Mike
Edit: and my theory worked out. Thank you again for getting my mind in gear.