Addressing another type within same type

Blitz3D Forums/Blitz3D Programming/Addressing another type within same type

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

Not 100% sure what your trying to do but you could probably make use of the old favourite - store the handle to the type instance in the entity name like so ...

type Mytype
  field Name$
  field Entity
  field Health
  field Etc..
end type

m.mytype = new mytype
m\Name = "Stevie G"
m\Entity = createsphere()
m\Health = 100
Nameentity m\Entity, handle( m )



To access directly based on the Target Entity ..

Test.mytype = object.mytype( entityname( TargetEntity ) )
Test\Health = Test\Health - 1


Another alternative would be to define an array of types ..


type MyType
  field name$
end type

dim MyTypes.MyType( 100 )

MyType(0 ) = new Mytype
MyType(0)\Name = "Joe Schmo"



So to access player 990 it would be ...

HisName$ = MyType( 990 )\Name



Stevie