HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Sorting System for variables

05-31-2004, 12:53 PM#1
xGT4x
I need a sorting system which sorts my variables "wins[1]-wins[10]" from the highest to the lowest value and if two or more of them are the same randomly chooses the rank for them so that every rank from 1 to 10 is used ONCE, not more and not less or it won't work in my trigger because every rank is a "starting"position in my trigger! Also some variables between 1 and 10 may not be used, they should be ignored and ranks from 1-(UsedVariables) should be done! I post my current system here, but it doesn't give random number if there are the same values!!!Here:
Code:
For each (Integer A) from 1 to 10, do (Actions)
    Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Wins[(Integer A)] Less than or equal to Wins[(Player number of (Picked player))]
                ((Player((Integer A))) slot status) Equal to Is playing
                ((Player((Integer A))) controller) Equal to User
            Then - Actions
                Set PlayerPosition = (PlayerPosition + 1)
            Else - Actions
I got it alone, you can close this thread, I just changed to this:
Code:
For each (Integer A) from 1 to 10, do (Actions)
    Loop - Actions
        For each (Integer B) from 1 to 10, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Wins[(Integer A)] x 100) + (Integer A)) Less than or equal to ((Wins[(Integer B)] x 100) + (Integer B))
                    Then - Actions
                        Set PlayerPosition[(Integer A)] = (PlayerPosition[(Integer A)] + 1)
                    Else - Actions
                        Do nothing