Jump to content

Issue with Array and For, Next loop


nitekram
 Share

Recommended Posts

I have worked all weekend on this and still am unable to make it faster - also I would like it to only make it through the cycle once rather than - in this example 3 times before it actually changes the INI file the correct way (the way I want it).

What I am trying to do is find all totalscores that are the same and then if the rank is different then change the rank to the highest rank out of the two. If the Rank is the same it then goes how many points were made and branches off in the same way trying to find out which one is the highest and change the Rank to match that one in the INI file.

Please make a copy of the INI file before running the code as it will change the INI file after each run. Again what I am trying to do is make the code faster and to make it go through the cycle one time.

In my example you will have to press the Dupes button 3 times before the INI file will change to the way I want it.

Any help will helpful...thanks for anyones help.

nitekram

Let me know if you have any questions

EDIT - the dupes button may be less than 3 times as I had to reduce the size of the INI file by half - by the way the INI file is now a TXT file, pease change the extension to INI

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

  • Moderators

nitekram,

I would be delighted to try and help, but..............

1. Your code does not run as it posted - you define _ArrayUnique as a function (it is already in Array.au3) and you call _StringSplit which is undefined (but which exists as the builtin command StringSplit). I take it you did not try to run the code before you posted. :evil:

2. Your ini file is ridiculously long - why not trim it down a bit for testing?

3. You speak of using the "totalscores" and "how many points were made" to adjust the ranking. Yet neither of these terms appear in your ini file and the former only once in the script in this line:

If $adiff2[$i][1] = $adiff2[$j][1] Then;totalscore

which might as well be in Chinese for all the sense it makes - because you have not commented your code at all! Are we supposed to read your mind as to what the code is trying to do? ;)

Please explain how to determine the "totalscores" and "how many points were made" and post a short example of what your ini should look like after you have done whatever it is you are trying to do - it is difficult to press the "Dupes" button 3 times when the code does not run. :idea:

Then we might get somewhere. :evil:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

nitekram,

I would be delighted to try and help, but..............

1. Your code does not run as it posted - you define _ArrayUnique as a function (it is already in Array.au3) and you call _StringSplit which is undefined (but which exists as the builtin command StringSplit). I take it you did not try to run the code before you posted. :evil:

2. Your ini file is ridiculously long - why not trim it down a bit for testing?

3. You speak of using the "totalscores" and "how many points were made" to adjust the ranking. Yet neither of these terms appear in your ini file and the former only once in the script in this line:

If $adiff2[$i][1] = $adiff2[$j][1] Then;totalscore

which might as well be in Chinese for all the sense it makes - because you have not commented your code at all! Are we supposed to read your mind as to what the code is trying to do? ;)

Please explain how to determine the "totalscores" and "how many points were made" and post a short example of what your ini should look like after you have done whatever it is you are trying to do - it is difficult to press the "Dupes" button 3 times when the code does not run. :idea:

Then we might get somewhere. :evil:

M23

sorry for the Chinese - i updated the code with some comments

the INI file is so large because the origanal is larger - lol. For testing i made it only 500 players - the issue is this, with the code that I am working with the RANK that is given to the players is determined from the code found here http://www.autoitscript.com/forum/index.php?showtopic=106363&st=0&p=751255&#entry751255

but the code makes some players rank different even though the totalrank (total score / games played ) - I need to be able to change those players that have the same totalrank to the same rank and hense the problem and the long code. It took me a while to figure out how to do what I have done

i fixed the file and uploaded it to the original post

the reason that i use _stringsplit() rather than stringsplit() is that i was getting different numbers each time I ran it? might have been a bug in my attempt or a bug in the function, did not know, but it ran fine with _stringsplit()

EDIT - the only thing that I am changing in the INI file is the RANK - to match the other RANK if the

TotalRank is the same

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

  • Moderators

nitekram,

It is no longer Chinese......it is Arabic! :)

From the other link you gave I seem to understand that you are trying to get a handicap system worked out - where the CONFIG section of the ini shows what percentage of the total number of players will get which ranking (which runs from 11 to 3 for some reason ;) ).

Now, quite frankly I cannot make any sense of your code - so, I will have a go from scratch. The golf course is covered with snow, so I have some time on my hands. :evil:

From what you have posted above, it seems as if you want the players initially ordered by TOTALRANK (i.e. points per game). If players have the same TOTALRANK then they should be ordered by "points" (confusingly labelled as TOTAL in the ini :idea: ). You then want any players who are still inseperable to ge given the same rank as the highest in their group. Like this:

Player  Rank   TOTALRANK  TOTAL
67      11     50         33
34      10     40         25
69      10     40         25  ; He should be ranked at 9 on the percentage rule, but is raised because he cannot be separated from No 34
23      9      40         20  ; He should be ranked at 9 on the percentage rule, and is because his TOTAL is lower than No 69

Am I close? :evil:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

nitekram,

It is no longer Chinese......it is Arabic! :)

From the other link you gave I seem to understand that you are trying to get a handicap system worked out - where the CONFIG section of the ini shows what percentage of the total number of players will get which ranking (which runs from 11 to 3 for some reason ;) ).

Now, quite frankly I cannot make any sense of your code - so, I will have a go from scratch. The golf course is covered with snow, so I have some time on my hands. :evil:

From what you have posted above, it seems as if you want the players initially ordered by TOTALRANK (i.e. points per game). If players have the same TOTALRANK then they should be ordered by "points" (confusingly labelled as TOTAL in the ini :idea: ). You then want any players who are still inseperable to ge given the same rank as the highest in their group. Like this:

Player  Rank   TOTALRANK  TOTAL
67      11     50         33
34      10     40         25
69      10     40         25  ; He should be ranked at 9 on the percentage rule, but is raised because he cannot be separated from No 34
23      9      40         20  ; He should be ranked at 9 on the percentage rule, and is because his TOTAL is lower than No 69

Am I close? :evil:

M23

RIGHT ON - sorry that I can't explain it very well. I have a hard time getting my hand/head on what I am thinking out in written form.

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

  • Moderators

nitekram,

Hallelujah! ;)

But do not hold your breath...this could take some time. :evil:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

nitekram,

OK, you can start breathing again. That was easier than I thought it would be - which is the way I prefer it.

Have a look at this script. I have commented it liberally so you should be able to follow what is going on - it is also a bit simpler than your original :evil: :

#include <GUIConstantsEx.au3>
#include <Array.au3>

; Declare these as Global so all functions can see them
Global $sIniFile = "Players.ini"
Global $aDetails[1][4], $iNumPlayers

; Create a GUI
$hGUI = GUICreate("Test", 500, 500)

$hRank = GUICtrlCreateButton("Rank", 10, 10, 80, 30)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hRank
            GUICtrlSetState($hRank, $GUI_DISABLE)
            Rank()
            GUICtrlSetState($hRank, $GUI_ENABLE)
    EndSwitch

WEnd

Func Rank()

    GUICtrlCreateLabel("Reading ini file", 30, 50, 200, 20)

    ; Load ini section names
    Local $aPlayers = IniReadSectionNames('Players.ini')

    ; Determine number of players
    $iNumPlayers = $aPlayers[0] - 1

    ; Remove element total and CONFIG section
    _ArrayDelete($aPlayers, 0)
    _ArrayDelete($aPlayers, 0)

    ; Create array to hold details
    Dim $aDetails[$iNumPlayers][4]
    For $i = 0 To $iNumPlayers - 1
        $aDetails[$i][0] = IniRead($sIniFile, $aPlayers[$i], "ID", 0)
        $aDetails[$i][1] = Number(IniRead($sIniFile, $aPlayers[$i], "RANK", 0))
        $aDetails[$i][2] = Number(IniRead($sIniFile, $aPlayers[$i], "TOTALRANK", 0))
        $aDetails[$i][3] = Number(IniRead($sIniFile, $aPlayers[$i], "TOTAL", 0))
    Next

    GUICtrlCreateLabel(Chr(0x50), 10, 50, 10, 10)
        GUICtrlSetFont(-1, 9, 600, 4, "Wingdings 2")

    GUICtrlCreateLabel("Sorting teams and setting ranks", 30, 80, 200, 20)

    ; Sort array on TOTALRANK so we get the players in that order
    _ArraySort($aDetails, 1, 0, 0, 2)

    ; Read TOTALRANK of top team
    $iStartIndex = 0
    ;  Then, starting at the top, work our way down the array
    ; and for each section of teams with equal TOTALRANK
    ; sort on TOTAL
    Do
        ; This is the TOTALRANK we are looking for
        $nCurrentTOTALRANK = $aDetails[$iStartIndex][2]
        ; Pass the index of the first team with this TOTALRANK score to the sorting function
        $iStartIndex = Sort_Equal_TOTALRANK($iStartIndex, $nCurrentTOTALRANK)
        ; The function has returned the index of the team with the next TOTALRANK
        ; So we can go round the loop again until we reach the bottom

    Until $iStartIndex > $iNumPlayers - 1

    ; Now we have the players ordered on TOTALRANK and TOTAL
    ; So we need to set the initial percentage rankings

    ; Read the percentages from the ini file
    $sPercent = IniRead($sIniFile, "CONFIG", "PERCENT", 0)
    ; Get rid of the count value
    $sPercent = StringTrimLeft($sPercent, 2)
    ; Split the string into the values
    $aPercent = StringSplit($sPercent, ",")

    ; Create an array to hold the indices of the team starting each rank level
    Local $aRankings[10]
    $iMaxPercent = 0
    $aRankings[0] = 0
    For $i = 1 To 9
        $iMaxPercent += $aPercent[$i]
        $aRankings[$i] = Int($iNumPlayers * $iMaxPercent / 100)
    Next

    ; Set the rankings according to these indices
    For $i = 0 to 8
        For $j = $aRankings[$i] To $aRankings[$i + 1] - 1
            $aDetails[$j][1] = 11 - $i
        Next
    Next

    ; Now we need to go through and adjust the rankings if TOTALRANK and TOTAL are equal
    ; We need to start looking at the last team in each rank level

    For $i = 1 To 8
        ; Last of the ranking teams is one above start of next rank
        $iStart = $aRankings[$i] - 1
        ; These are the values for that team
        $iRank = $aDetails[$iStart][1]
        $iCurrTOTALRANK = $aDetails[$iStart][2]
        $iCurrTOTAL = $aDetails[$iStart][3]
        ; Run down the array until these values are no longer the same
        For $j = $iStart + 1 To $iNumPlayers - 1
            If $aDetails[$j][2] = $iCurrTOTALRANK And $aDetails[$j][3] = $iCurrTOTAL Then
                ; Increase the rank if the values are the same
                $aDetails[$j][1] = $iRank
            Else
                ; Move on to the next rank junction
                ExitLoop
            EndIf
        Next
    Next

    GUICtrlCreateLabel(Chr(0x50), 10, 80, 10, 10)
        GUICtrlSetFont(-1, 9, 600, 4, "Wingdings 2")

    GUICtrlCreateLabel("Writing new ranks into ini file", 30, 110, 200, 20)

    ; Now we put the adjusted rank values into the ini file
    For $i = 0 To $iNumPlayers - 1
        $sCurrRank = IniRead($sIniFile, "Player" & $aDetails[$i][0], "RANK", 0)
        If $sCurrRank <> $aDetails[$i][1] Then IniWrite($sIniFile, "Player" & $aDetails[$i][0], "RANK", $aDetails[$i][1])
    Next

    GUICtrlCreateLabel(Chr(0x50), 10, 110, 10, 10)
        GUICtrlSetFont(-1, 9, 600, 4, "Wingdings 2")

    ; And we are all done!

EndFunc

Func Sort_Equal_TOTALRANK($iStart, $nTOTALRANK)

    ; We have the index of the first team with the same TOTALRANK
    ; Move through the array to count players with the same TOTALRANK
    For $i = $iStart To $iNumPlayers - 1
        If $aDetails[$i][2] <> $nTOTALRANK Then ExitLoop
    Next
    ; $i = the index of the first team witha lower TOTALRANK
    ; It is also the first index of the next comparison
    $iNextStart = $i

    ; Set indices of the equal TOTALRANKed players
    $iFirst = $iStart
    $iLast = $i - 1

    ; And sort these players on TOTAL
    If $iLast > $iFirst Then _ArraySort($aDetails, 1, $iFirst, $iLast, 3)

    ; return the index for the next search/sort
    Return $iNextStart

EndFunc

I added the labels to show how the script was progressing. As you can see, the actual sorting and ranking takes almost no time at all - it is all done in memory - and it is rewriting the ini file that is taking the time. This is because AutoIt has to open and close this gigantic file for each operation (and using your current ini file we only change the rank for 31 of the 500 teams! :evil: )

You might like to think about having a separate ini file just for the rankings - it would not be hard to implement. But then how many rankings will change each time you run the script? Probably not too many and so the delay will only be around current levels.

Anyway, I hope this version does what you want. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

nitekram,

OK, you can start breathing again. That was easier than I thought it would be - which is the way I prefer it.

Have a look at this script. I have commented it liberally so you should be able to follow what is going on - it is also a bit simpler than your original :evil: :

#include <GUIConstantsEx.au3>
#include <Array.au3>

; Declare these as Global so all functions can see them
Global $sIniFile = "Players.ini"
Global $aDetails[1][4], $iNumPlayers

; Create a GUI
$hGUI = GUICreate("Test", 500, 500)

$hRank = GUICtrlCreateButton("Rank", 10, 10, 80, 30)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hRank
            GUICtrlSetState($hRank, $GUI_DISABLE)
            Rank()
            GUICtrlSetState($hRank, $GUI_ENABLE)
    EndSwitch

WEnd

Func Rank()

    GUICtrlCreateLabel("Reading ini file", 30, 50, 200, 20)

    ; Load ini section names
    Local $aPlayers = IniReadSectionNames('Players.ini')

    ; Determine number of players
    $iNumPlayers = $aPlayers[0] - 1

    ; Remove element total and CONFIG section
    _ArrayDelete($aPlayers, 0)
    _ArrayDelete($aPlayers, 0)

    ; Create array to hold details
    Dim $aDetails[$iNumPlayers][4]
    For $i = 0 To $iNumPlayers - 1
        $aDetails[$i][0] = IniRead($sIniFile, $aPlayers[$i], "ID", 0)
        $aDetails[$i][1] = Number(IniRead($sIniFile, $aPlayers[$i], "RANK", 0))
        $aDetails[$i][2] = Number(IniRead($sIniFile, $aPlayers[$i], "TOTALRANK", 0))
        $aDetails[$i][3] = Number(IniRead($sIniFile, $aPlayers[$i], "TOTAL", 0))
    Next

    GUICtrlCreateLabel(Chr(0x50), 10, 50, 10, 10)
        GUICtrlSetFont(-1, 9, 600, 4, "Wingdings 2")

    GUICtrlCreateLabel("Sorting teams and setting ranks", 30, 80, 200, 20)

    ; Sort array on TOTALRANK so we get the players in that order
    _ArraySort($aDetails, 1, 0, 0, 2)

    ; Read TOTALRANK of top team
    $iStartIndex = 0
    ;  Then, starting at the top, work our way down the array
    ; and for each section of teams with equal TOTALRANK
    ; sort on TOTAL
    Do
        ; This is the TOTALRANK we are looking for
        $nCurrentTOTALRANK = $aDetails[$iStartIndex][2]
        ; Pass the index of the first team with this TOTALRANK score to the sorting function
        $iStartIndex = Sort_Equal_TOTALRANK($iStartIndex, $nCurrentTOTALRANK)
        ; The function has returned the index of the team with the next TOTALRANK
        ; So we can go round the loop again until we reach the bottom

    Until $iStartIndex > $iNumPlayers - 1

    ; Now we have the players ordered on TOTALRANK and TOTAL
    ; So we need to set the initial percentage rankings

    ; Read the percentages from the ini file
    $sPercent = IniRead($sIniFile, "CONFIG", "PERCENT", 0)
    ; Get rid of the count value
    $sPercent = StringTrimLeft($sPercent, 2)
    ; Split the string into the values
    $aPercent = StringSplit($sPercent, ",")

    ; Create an array to hold the indices of the team starting each rank level
    Local $aRankings[10]
    $iMaxPercent = 0
    $aRankings[0] = 0
    For $i = 1 To 9
        $iMaxPercent += $aPercent[$i]
        $aRankings[$i] = Int($iNumPlayers * $iMaxPercent / 100)
    Next

    ; Set the rankings according to these indices
    For $i = 0 to 8
        For $j = $aRankings[$i] To $aRankings[$i + 1] - 1
            $aDetails[$j][1] = 11 - $i
        Next
    Next

    ; Now we need to go through and adjust the rankings if TOTALRANK and TOTAL are equal
    ; We need to start looking at the last team in each rank level

    For $i = 1 To 8
        ; Last of the ranking teams is one above start of next rank
        $iStart = $aRankings[$i] - 1
        ; These are the values for that team
        $iRank = $aDetails[$iStart][1]
        $iCurrTOTALRANK = $aDetails[$iStart][2]
        $iCurrTOTAL = $aDetails[$iStart][3]
        ; Run down the array until these values are no longer the same
        For $j = $iStart + 1 To $iNumPlayers - 1
            If $aDetails[$j][2] = $iCurrTOTALRANK And $aDetails[$j][3] = $iCurrTOTAL Then
                ; Increase the rank if the values are the same
                $aDetails[$j][1] = $iRank
            Else
                ; Move on to the next rank junction
                ExitLoop
            EndIf
        Next
    Next

    GUICtrlCreateLabel(Chr(0x50), 10, 80, 10, 10)
        GUICtrlSetFont(-1, 9, 600, 4, "Wingdings 2")

    GUICtrlCreateLabel("Writing new ranks into ini file", 30, 110, 200, 20)

    ; Now we put the adjusted rank values into the ini file
    For $i = 0 To $iNumPlayers - 1
        $sCurrRank = IniRead($sIniFile, "Player" & $aDetails[$i][0], "RANK", 0)
        If $sCurrRank <> $aDetails[$i][1] Then IniWrite($sIniFile, "Player" & $aDetails[$i][0], "RANK", $aDetails[$i][1])
    Next

    GUICtrlCreateLabel(Chr(0x50), 10, 110, 10, 10)
        GUICtrlSetFont(-1, 9, 600, 4, "Wingdings 2")

    ; And we are all done!

EndFunc

Func Sort_Equal_TOTALRANK($iStart, $nTOTALRANK)

    ; We have the index of the first team with the same TOTALRANK
    ; Move through the array to count players with the same TOTALRANK
    For $i = $iStart To $iNumPlayers - 1
        If $aDetails[$i][2] <> $nTOTALRANK Then ExitLoop
    Next
    ; $i = the index of the first team witha lower TOTALRANK
    ; It is also the first index of the next comparison
    $iNextStart = $i

    ; Set indices of the equal TOTALRANKed players
    $iFirst = $iStart
    $iLast = $i - 1

    ; And sort these players on TOTAL
    If $iLast > $iFirst Then _ArraySort($aDetails, 1, $iFirst, $iLast, 3)

    ; return the index for the next search/sort
    Return $iNextStart

EndFunc

I added the labels to show how the script was progressing. As you can see, the actual sorting and ranking takes almost no time at all - it is all done in memory - and it is rewriting the ini file that is taking the time. This is because AutoIt has to open and close this gigantic file for each operation (and using your current ini file we only change the rank for 31 of the 500 teams! :evil: )

You might like to think about having a separate ini file just for the rankings - it would not be hard to implement. But then how many rankings will change each time you run the script? Probably not too many and so the delay will only be around current levels.

Anyway, I hope this version does what you want. ;)

M23

WOW - its a lot faster than mine. I am testing now, but thanks for all your help!!!

EDIT

I have looked over the code and have one question to start?

I found a FOR/NEXT loop in your code under Sort_Equal_TOTALRANK() - what does this part do?

For $i = $iStart To $iNumPlayers - 1
        If $aDetails[$i][2] <> $nTOTALRANK Then ExitLoop
    Next

EDIT2 nevermind - let me look a little deeper - I now see a do/while loop

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

  • Moderators

nitekram,

If you use the "Add Reply" button at the top and bottom of the page rather then the "Reply" button in the post itself, you do not get the contents of the previous post quoted in your reply and the whole thread becomes easier to read. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Isn't there still a pretty significant risk with using INI files- size limitations causing the functions to just stop working after a certain size and all, or has that issue finally gone away?

Not to muddy the waters, but I highly recommend looking into the _SQLite functions for stuff like this (I got into it when I hit INI size limitations a few years ago and never looked back). One benefit it would have for this script is "automatic" ranking- just specify a few categories of data in the ORDER BY part of the statement, and it would return you the ranks automatically, the way you wanted (for instance, it might look something like

SELECT rank FROM teams ORDER BY TotalRank,Total
for your script, so it would order by TotalRank, then in the event of a tie, sub-rank by Total.

...anyway, that's just my $.02 I just wanted to find out if the INI limits are still a factor, and make sure the OP was aware of them if they are. Since they're literally wrappers around a call for the OS to read the ini file, I was under the impression there was no good way around them. Please ignore me if you'd like ;)

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
Link to comment
Share on other sites

Hey, I found the ADD Reply button - ;)

Anyway I was testing your code and found that if I drop the number of players to 25 (my last limitation) I get the following error:

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\!HANDIPOOL\dupes from melba23.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams

+>16:14:44 Starting AutoIt3Wrapper v.1.10.1.14 Environment(Language:0409 Keyboard:00000409 OS:WIN_XP/Service Pack 3 CPU:X86 ANSI)

>Running AU3Check (1.54.13.0) from:C:\Program Files\AutoIt3

+>16:14:44 AU3Check ended.rc:0

>Running:(3.2.12.1):C:\Program Files\AutoIt3\autoit3.exe "C:\!HANDIPOOL\dupes from melba23.au3"

C:\!HANDIPOOL\dupes from melba23.au3 (112) : ==> Array variable subscript badly formatted.:

$iRank = $aDetails[$iStart][1]

$iRank = $aDetails[^ ERROR

->16:14:48 AutoIT3.exe ended.rc:1

+>16:14:49 AutoIt3Wrapper Finished

>Exit code: 1 Time: 5.740

Any ideas on how I can fix this - I am still reading your comments and trying to digest the code!

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

  • Moderators

james3mg,

As I understand it, there is currently no limit on the ini file per se, just a limit on the content of a [sECTION]. There was talk that the whole Ini* code would be looked at in the next update - but I am not holding my breath. :evil:

I also thought of _SQLite, but as I am still getting to grips with it, I preferred not to go there. If you want to have a go at doing this in a DB, please feel free to jump in - I would be happy to learn something new. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

nitekram,

I suspect this is the same problem you were warned about in your "percentage" topic: if the number of players is too small, you will not get every rank level present and so the arrays are not fully populated.

You mentioned earlier that this ini file was but a small one - yet you now talk of 25 players minimum. Moving goalposts is something that really irritates me, you know! ;)

However, if 25 players is the minimum you want to work with, we need to play with the code to get over this problem (if we can!). I will get back when I can.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

james3mg,

As I understand it, there is currently no limit on the ini file per se, just a limit on the content of a [sECTION]. There was talk that the whole Ini* code would be looked at in the next update - but I am not holding my breath. :evil:

I also thought of _SQLite, but as I am still getting to grips with it, I preferred not to go there. If you want to have a go at doing this in a DB, please feel free to jump in - I would be happy to learn something new. ;)

M23

OK, good to know about the limits- that seems to agree with my hazy memory of what I used to run into.

I'll see if I can squeeze in a bit 'o time between projects to look at converting this to a SQLite system, we'll see :evil:

Edit: I didn't realize at first that this isn't a complete system; this script just edits the rankings in an .ini file generated by another script. So, unless Nikeram wanted to post the main script and get help porting that over to saving it's data in an SQLite database, it probably wouldn't do much good to do just this part in SQLite...I'd be converting the INI to a database, sorting (nearly instantly), but then having to write the new values back into the ini one-at-a-time, just like your script, lol. The time difference would be negligable at best. So I'll back off again and leave it in your capable hands, sorry I butted in :idea:

By the way, I wrote a UDF a little over a year ago that allows you to read/write SQLite databases using the INI functions syntax- it's over here if you're interested, as you're getting started with SQLite. However, it wouldn't be very good for a project like this, as it will be even a little slower than the INI functions at writing lots of keys, one right after the other. (this won't be a problem if the whole thing was converted into a real SQLite database, as you can tell it to just open the database once, write lots of keys, and commit the changes ONCE when you're done).

Edited by james3mg
"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
Link to comment
Share on other sites

Also, I ran the INI file with my code (after running your code) and still found TotalRank scores that were the same with different Ranks?

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

nitekram,

I suspect this is the same problem you were warned about in your "percentage" topic: if the number of players is too small, you will not get every rank level present and so the arrays are not fully populated.

You mentioned earlier that this ini file was but a small one - yet you now talk of 25 players minimum. Moving goalposts is something that really irritates me, you know! ;)

However, if 25 players is the minimum you want to work with, we need to play with the code to get over this problem (if we can!). I will get back when I can.

M23

Sorry about not stating the limit to begin with, really it is not a big deal - the number I came up with so far with your code is 50 players.

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

  • Moderators

nitekram,

TotalRank scores that were the same with different Ranks

The criterion you set for ranking was the percentages list that you set - these percentage cuts can, and often will, overlap the TOTALRANK scores. You then asked for players with the same Rank, TOTALRANK and TOTAL (I do wish you had named these differently! :evil: ) to be moved up to the rank of the highest placed. So it is quite likely that there are players with the same TOTALRANK who do not have the same Rank - if they have different TOTALs. If this is not the case, then do come back - or specify exactly what you do want as criteria..... ;)

I have some ideas on how to get over the "small" limit in the current code - again, however, do not hold your breath. :evil:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

OK, again thanks for your help...the reason that the Ranks have to be the same is that if X player were to look at their Rank and compare it to another with the same TotalRank then there would be an issue with handi capping the said player and therefore the team would or could get an unfair advantage.

The code I wrote, (I think) goes through the TotalRanks, finds all the ones that have the same TotalRanks and with that the ID's and then removes any dupe ID's from the list. It then goes over the TotalRanks again to see if there is a difference between the the Ranks for the same TotalRank. If it finds a difference it then changes the lowest Rank to match the higher Rank (it really does not matter if it changes it to the lower Rank as long as they are the same). If both the TotalRanks and Ranks are different, but the Made points are higher for the higher Rank then that is cool, but if it is lower then it has to be the lower of the two ranks and the other has to be made the higher of the two Ranks - does any of this make sence?

My code does not do the last part. Any help on what I want will be greatful.

If I do not hear from you before XMAS - Happy Holidays

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

  • Moderators

nitekram,

The latest version! ;) Changes:

I have fixed the code to work with a minimum of 11 players. It meant altering the percentage ratios for the Ranks - they must now read:

[CONFIG]
PERCENT=9,2,8,13,17,20,17,13,8,2

I did this to get the $aRankings array to have unique values in each element - the changed percentage amounts allow the minimum to get as low as it did. If you want to keep the original percentage ratios - write your own patch! :evil:

The code now looks for duplicate IDs and, if it finds any, warns you. I have no idea which of the duplicates you would want to delete, so the script shows a MsgBox identifying which sections have the same ID values and then exits.

The script now sorts on TOTALRANK and MADE as you requested in your last post.

When you run it on your original ini file it there are a number of changes to the rankings (as you woudl expect as I have changed the percentage ratios) but it also adjusts the following because of identical TOTALRANK values:

PlayerNumber  ID       Rank      TOTALRANK      MADE
377           388      6         -4.7273        46
378           76       6         -4.75          24
379           19       6         -4.75          0
380           496      6         -4.75          0      ; Rank increased because inseperable from team above
381           44       5         -4.7647        22

PlayerNumber  ID       Rank      TOTALRANK      MADE
453           16       5         -6.25          0
454           477      5         -6.3333        0
455           51       5         -6.3333        0      ; Rank increased because inseperable from team above
456           269      4         -6.3846        0

PlayerNumber  ID       Rank      TOTALRANK      MADE
486           347      4         -8.6667        0
487           200      4         -9             0
488           374      4         -9             0      ; Rank set by percentage ratios
489           148      4         -9             0      ; Rank set by percentage ratios
490           476      4         -9             0      ; Rank increased because inseperable from team above
491           321      4         -9             0      ; Rank increased because inseperable from team above
492           404      4         -9             0      ; Rank increased because inseperable from team above
493           43       4         -9             0      ; Rank increased because inseperable from team above
494           229      3         -10            0

I hope we have got there now. :evil:

Merry Xmas.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thanks for all your help!

Can you post the code ;)

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...