%count = 0;
while(!%file.isEOF())
{
%line[%count] = %file.readLine();
%count++;
}
%file.close();
%file.delete();
while(%count != 0)
{
%high = ""; // resetting the variable
for(%i=0;%i<%count;%i++)
if(getField(%line[%count],1) >= getField(%high,1))
%high = %line[%count]; // if the score is higher than the previously checked score, set %high to the new line
%data = new ScriptObject(HighscoreData)
{
bl_id = getField(%high,0);
score = getField(%high,1);
};
CrumbleHighscoreList.add(%data); // add that line to the set
for(%j=%i;%j<%count;%j++)
%line[%count] = %line[%count-1]; // and remove it from local variables
%count--;
}
Was wanting to just sort everything as it's added to the set.
Right now it's just adding lines to the set as it gets to them, e.g.
18701 456
28394 785
98404 256
102931 1023
39303 493
39485 394
4742 125
would output that in reverse, and minus the last line