master2.blockland.us
the query tcp gets the html webpage and then parses it, each line found creates an object with the correct vars from the line and puts them into a group, found by this function
function ServerInfoSO_Add(%ip, %pass, %ded, %name, %currPlayers, %maxPlayers, %mods, %map, %brickCount, %demoPlayers)
{
if ($ServerSO_Count <= 0)
$ServerSO_Count = 0;
new ScriptObject(ServerSO){
ping = "???";
ip = %ip;
pass = %pass;
ded = %ded;
name = %name;
currPlayers = %currPlayers;
maxPlayers = %maxPlayers;
mods = %mods;
map = %map;
brickCount = %brickCount;
demoPlayers = %demoPlayers;
id = $ServerSO_Count;
};
$ServerSO[$ServerSO_Count] = 0;
if (!isObject("ServerInfoGroup"))
{
new SimGroup("ServerInfoGroup"){
};
RootGroup.add("ServerInfoGroup");
}
ServerInfoGroup.add($ServerSO[$ServerSO_Count]);
%strIP = %ip;
%strIP = strreplace(%strIP, ".", "_");
%strIP = strreplace(%strIP, ":", "X");
$ServerSOFromIP[%strIP] = $ServerSO_Count;
$ServerSO_Count++;
}
after the objects are done being added it will then send a command to add stuff to a text list control (which is how it displays your servers)
there are 3 methods of creating 'arrays' - each depends on what you are planning to do with them
- create a text list control and add rows to them
- create a scriptgroup and add a script object for new objects (not recommended)
- create a list of global vars and use them any time (best option for this case)
global vars are the easiest one, if you want to erase global variables based on their name, use: deleteVariables("$varName*"); which will delete all variables starting with "$varName"
example of creating an array of global variables
for(%i = 1; %i <= 10; %i++) {
$Client::Stuff[$Client::Stuff++] = "line " @ %i;
}
10 times, it will make $Client::Stuff1, $Client::Stuff2, $Client::Stuff3, and so on until the loop stops, this also increases the var $Client::Stuff, which the value should be 10
if you run this more than once without setting the $Client::Stuff back to 0, it'll start from where it was and will repeat the same process