Types Again!!!

Blitz3D Forums/Blitz3D Beginners Area/Types Again!!!

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

as I said before
for variable=each [YOU CAN ONLY PUT A TYPE NAME HERE]

is there a type called "p.psk.skills"? no. you cannot even make one called that
the types in the program are "player" and "skill" so thats all you can put after "each"

the simplest way is
Graphics 400,300,16,3

Type Player
Field Playername$
End Type

Type skill
Field skillname$
Field player.player
End Type

p.player=New Player
p\playername$="John"
s.skill=New skill
s\skillname$="Jump"
s\player=p
s.skill=New skill
s\skillname$="Hello"
s\player=p

p.player=New Player
p\playername$="Joe"
s.skill=New skill
s\skillname$="Punch"
s\player=p
s.skill=New skill
s\skillname$="Duck"
s\player=p

Print "Players: "
For a.player=Each player
Print a\playername$
Next

Print " "
Print "Skills:"
For j.skill=Each skill
Print j\skillname$
Next

For a.player=Each player
Print a\playername+":"
For j.skill=Each skill
If j\player=a Then Print j\skillname$
Next
Next


I hope that helps