- Joined
- Sep 26, 2005
- Messages
- 40
I am trying to figure out something that should be simple but is really proving difficult for me..
i would like to reorder players based on their scores.
In my game i have 2 variables per player. one tracks Kills with an array size equal to 10 since it is a 10-player game. also have one that keeps track of Deaths.
i subtract the deaths from the kills and set that value to a variable. example:
for each integer A from 1 to 10
loop:
set RoundtallyVar[integer a] = kills[integer A] - deaths[integer a]
note;
the kills/deaths are set up and used in several other triggers where "integer A" is in line with the players 1 - 10
so what i want to do is reorder their names in a string variable according to score and not player order.
example; if player 5 has the highest score then that players name should be set to equal RoundStringVar[1]
and if player 8 has the 2nd highest score then they should be set to the 2nd array.
then i want to display each name as a button in a dialog showing each players name in order of score.
i havn't been able to figure out how to do the score comparisons...
the only idea i've come up with is: i've tried doing an integer B loop 1-10 within an integer A loop 1-10 with an if/then/else within the B loop with a condition that compares if the RoundtallyVar[integer a] greater than or equal to RoundtallyVar[integer b]
and if it does i have another non-array integer variable + 1 itself ... so then if that integer = 10 during the 1st loop of A then it should mean that player 1 has a higher score than everyone else and at least equal to his own score when A loop 1 checks against B loop 1. so then player 1 would be in first place, if not at least tie with other players.
since this would do 10X10 = 100 checks i have another condition that checks if that integer is 10 or over and stops if it is so that it does not exceed 10
that is as far as i've got. it's confusing the heck out of me! been looking at this for 3 days now.
i would like to reorder players based on their scores.
In my game i have 2 variables per player. one tracks Kills with an array size equal to 10 since it is a 10-player game. also have one that keeps track of Deaths.
i subtract the deaths from the kills and set that value to a variable. example:
for each integer A from 1 to 10
loop:
set RoundtallyVar[integer a] = kills[integer A] - deaths[integer a]
note;
the kills/deaths are set up and used in several other triggers where "integer A" is in line with the players 1 - 10
so what i want to do is reorder their names in a string variable according to score and not player order.
example; if player 5 has the highest score then that players name should be set to equal RoundStringVar[1]
and if player 8 has the 2nd highest score then they should be set to the 2nd array.
then i want to display each name as a button in a dialog showing each players name in order of score.
i havn't been able to figure out how to do the score comparisons...
the only idea i've come up with is: i've tried doing an integer B loop 1-10 within an integer A loop 1-10 with an if/then/else within the B loop with a condition that compares if the RoundtallyVar[integer a] greater than or equal to RoundtallyVar[integer b]
and if it does i have another non-array integer variable + 1 itself ... so then if that integer = 10 during the 1st loop of A then it should mean that player 1 has a higher score than everyone else and at least equal to his own score when A loop 1 checks against B loop 1. so then player 1 would be in first place, if not at least tie with other players.
since this would do 10X10 = 100 checks i have another condition that checks if that integer is 10 or over and stops if it is so that it does not exceed 10
that is as far as i've got. it's confusing the heck out of me! been looking at this for 3 days now.