Author Topic: Something to stop the master server list shuffling  (Read 985 times)

The way it shuffles about for a while when refreshing and sorting by players.

The problem is that rows are deleted and inserted again as more servers get their ping results, which makes the sort function get different results.

It could be fixed by editing the rows instead of re-creating and not sorting the list again after getting ping results if it's not being sorted by ping.
« Last Edit: April 25, 2015, 04:27:36 PM by Zeblote »

Maybe make it sort them alphabetically.

Maybe make it sort them alphabetically.
You'd have to write a lame slow sort function in torquescript, the c++ sorting for the guitextlistctrl works on one comlumn only.

This is a very dirty fix:

Code: serverlistfix.cs (39 lines)
package ServerListSortFix
{
    function ServerInfoSO_UpdatePing(%ip, %ping)
    {
       %strIP = %ip;
       %strIP = strreplace(%strIP, ".", "_");
       %strIP = strreplace(%strIP, ":", "X");
       %idx = $ServerSOFromIP[%strIP];
       %obj = $ServerSO[%idx];

       if(isObject(%obj))
        {
           //No need to re-sort the list every time a ping is received...
            //%obj.ping = %ping;
            //%obj.Display();

           %obj.ping = %ping;
            JS_serverList.setRowByID(%obj.id, %obj.serialize());
        }
       else
       {
           error("ERROR: ServerInfoSO_UpdatePing() - No script object found for ip: ", %strIP);
        }
    }

    function ServerInfoSO_DisplayAll()
    {
       parent::ServerInfoSO_DisplayAll();

       //Sort the list once after adding all servers
       if(JS_serverList.sortedNumerical)
            JS_serverList.sortNumerical(JS_serverList.sortedBy, JS_serverList.sortedAsc);
       else
           JS_serverList.sort(JS_serverList.sortedBy, JS_serverList.sortedAsc);
    }
};

activatePackage(ServerListSortFix);


zeblote, do you really spend time color-coding the code?

zeblote, do you really spend time color-coding the code?
he has a script that does that


zeblote, do you really spend time color-coding the code?
I found an existing plugin for sublime text that exports syntax highlighting to html and bbcode, then modified it slightly to optimize the ammount of useless bbcode it generates as blockland forum has a stupidly low character limit

Though it is written in python and I never used python so my changes are probably not the most efficient. You can add it using package control with "Add Repository" and then pasting this link https://github.com/Zeblote/ExportHtml/tree/master



Eh, i'd probably just write a java program to generate the bb code; cool anyways though.