I think I know what you mean, here's my take on it:
You have to remember that when you declare a type, all you are doing is starting a list of 'npc_dat's. When you create a 'new npc_dat', you're just simply adding to that list. Imagine you're drawing a list out on paper and you have your red pen (your 'player.npc_dat' variable) lined up against the first item. The black pen is lined up against the first item as well - this represents the 'npc.npc_dat' variable. The pens can point to any one of the items in the 'npc_dat' list by either looping through them, or declaring another variable (aka using another pen to point with). All you are doing when you declare a 'randomvariablename.npc_dat' is creating a pointer to that list item. You can create pointers within types to other items in the list as well.
type npc_dat field x, y, z field target.npc_dat end type ; Create player NPC player.npc_dat = new npc_dat ; Create 10 NPC's for n=0 to 9 npc.npc_dat = new npc_dat next ; Makes the field 'target' point to the last 'NPC' player\target.npc_dat = last npc_dat ; Delete the current player delete player ; Point player.npc_dat to the last npc_dat player.npc_dat = last npc_dat
You have to remember that when you declare a type, all you are doing is starting a list of 'npc_dat's. When you create a 'new npc_dat', you're just simply adding to that list. Imagine you're drawing a list out on paper and you have your red pen (your 'player.npc_dat' variable) lined up against the first item. The black pen is lined up against the first item as well - this represents the 'npc.npc_dat' variable. The pens can point to any one of the items in the 'npc_dat' list by either looping through them, or declaring another variable (aka using another pen to point with). All you are doing when you declare a 'randomvariablename.npc_dat' is creating a pointer to that list item. You can create pointers within types to other items in the list as well.