is it possible to create a dim of a type within another type
ie
type mapsector
field x
field y
ect
ect
end type
type map
field a.mapsector[10,10]
end type
ie
type mapsector
field x
field y
ect
ect
end type
type map
field a.mapsector[10,10]
end type
Graphics 800,600,32,0 Type Generic_Type Field id Field Name$ Field Weight Field Height End Type Type Monster_Type Field Id Field Monster_Name$ Field Generic_Details.Generic_Type[100] End Type Global Monster.Monster_Type Global generic.generic_type monster = New monster_type monster\Id = 0 monster\Monster_Name = "Orc" For i = 0 To 9 monster\Generic_Details[i] = New Generic_Type generic = monster\Generic_Details[i] generic\id = i generic\name = "Orc " + i generic\height = 150 + i * 5 generic\weight = 120 + i * 5 Next monster = New monster_type monster\Id = 0 monster\Monster_Name = "Warg" For i = 0 To 9 monster\Generic_Details[i] = New Generic_Type generic = monster\Generic_Details[i] generic\id = i generic\name = "Warg " + i generic\height = 250 + i * 10 generic\weight = 400 + i * 10 Next For monster = Each monster_type Print "Monster Type Id : " + monster\Id Print "Monster Name : " + monster\Monster_name For i = 0 To 9 generic = monster\generic_details[i] Print " Individual Monster Id " + generic\id + " Name " + generic\Name + " Height " + generic\Height + " Weight " + generic\Weight Next Next While Not KeyDown(1) Wend End
type mapsector field x field y ect ect end type type map field a.mapsector[10] end type mymap.map = new map mymap\a[1]=new mapsector mymap\a[2]=new mapsector mymap\a[1]\x=10 mymap\a[1]\y=100 print mymap\a[1]\yHowever, there is very simple algorithm used by many compilers to calcuate the linear index of multi dimensional arrays. You can apply the formula yourself. One way or another this math is applied.
dim maparray.map(10) ;notice the parenthesis '(' & ')' maparray(1)=new map maparray(1)\a[1]=new mapsector maparray(1)\a[1]\y=10 print maparray(1)\a[1]\yYou can also do this:
global staticarray.map[100]; notice the 'global keyword and '[' & ']' brackets. staticarray[4] = New map staticarray[4]\a[1]=New mapsector staticarray[4]\a[1]\x=21 Print staticarray[4]\a[1]\xThis difference between them is that you cannot redim a staticarray and its limited to 1 dimension.
Type Box Field Value[10] Field Spritr_id Field Active Field x Field z End Type Dim Grid.box(10,10) Grid.box(1,1)=New box grid(1,1)\value[1]=10 Grid.box(1,2)=New box grid(1,2)\value[1]=30 Print grid(1,1)\value[1] Print grid(1,2)\value[1]