Identifying an individual 'type'

Blitz3D Forums/Blitz3D Beginners Area/Identifying an individual 'type'

Tobo(Posted 2008) [#1]
Wotcha, folks.

I'm trying to knock together a quick league of sorts and have come up against a (hopefully simple) problem.

I have 10 teams in my type. the fields are name,points,position.

I'm looping through the types to find the one with the most points, say 20. When the loop has finished and I have my highest figure, how do I then refer back to that type/team?

Hope I've explained that right.

Many thanks.

tobo.


Ross C(Posted 2008) [#2]
Use Object Handle commands

OR

do this:

Global highestpoints.team

Then when looping through all your types, set the highest one found to the above.

If t.team = highest points then
highestpoints.team = t.eam
End if

Not exactly blitz code, but you get my drift. I'll knock something to together to better explain when i get home if you need it.


Dreamora(Posted 2008) [#3]
highestTeam.team = null

for a.team = each team
  if a\points > highestTeam\points
    highestTeam = a
  endif
next



Stevie G(Posted 2008) [#4]
Dreamora's won't work as highestteam initially point to a null type therefore does not have any associated fields.

Best to just initialise with ..

highestTeam.team = first team

Stevie