"$server::brickCount" does not work

Author Topic: "$server::brickCount" does not work  (Read 5077 times)

Whenever I type echo($server::brickCount); into the console, it always returns an empty string. There are actually bricks on the BL server. Is there any other way to get the total brick count on the server?

I'm pretty sure there's a getBrickCount() function. To get the true brick group, go through the MainBrickGroup and sum the counts of the child groups.

Where'd you even hear $Server::BrickCount was a real variable?


for(%i = 0; %i < MainBrickGroup.getCount(); %i++)
{
    for(%j = 0; %j < MainBrickGroup.getObject(%i).getCount(); %j++)
    {
        echo(%j);
    }
}

??
Oh wait. This won't add all of them together, it gives you the amount in each brickgroup. As far as adding them all together, I have no idea.

%bricks = 0;
%groups = MainBrickGroup.getCount();

for (%i = 0; %i < %groups; %i++)
{
    %bricks += MainBrickGroup.getObject(%i).getCount();
}

$Server::BrickCount was the old way to do it. Badspot removed it.

getBrickCount() is what you want. No need to loop through mainBrickGroup.

getBrickCount() is what you want. No need to loop through mainBrickGroup.

/getRealBrickCount (or something) exists for a reason: the counter can screw up. But regardless, yeah, as I said, it's getBrickCount().

/getRealBrickCount (or something) exists for a reason: the counter can screw up. But regardless, yeah, as I said, it's getBrickCount().

/realBrickcount, but that always shows 0 bricks.

/realBrickcount iterates through MissionCleanup instead of the mainbrickgroup for some reason.

/getRealBrickCount (or something) exists for a reason: the counter can screw up. But regardless, yeah, as I said, it's getBrickCount().

Really it's the mod creator's fault if they don't add stuff to mainbrickgroup.
« Last Edit: June 29, 2014, 08:42:50 PM by Greek2me »

Really it's the mod creator's fault if they don't add stuff to mainbrickgroup.
Lol. I did this once. Caused me so much frustration that I gave up on the project until I realized that you had to add it.


for(%i = 0; %i < MainBrickGroup.getCount(); %i++)
{
    for(%j = 0; %j < MainBrickGroup.getObject(%i).getCount(); %j++)
    {
        echo(%j);
    }
}

??
Oh wait. This won't add all of them together, it gives you the amount in each brickgroup. As far as adding them all together, I have no idea.
You'd do this to add them together.


%total = 0;

for(%i = 0; %i < MainBrickGroup.getCount(); %i++)
{
    for(%j = 0; %j < MainBrickGroup.getObject(%i).getCount(); %j++)
    {
        %subCount = %j;
    }
    %total = %total + %subCount;
}
echo(%total);


Definitely not the most efficient piece of code though. :/

You'd do this to add them together.


%total = 0;

for(%i = 0; %i < MainBrickGroup.getCount(); %i++)
{
    for(%j = 0; %j < MainBrickGroup.getObject(%i).getCount(); %j++)
    {
        %subCount = %j;
    }
    %total = %total + %subCount;
}
echo(%total);


Definitely not the most efficient piece of code though. :/
No it's not. That's why you use Port's code.

No it's not. That's why you use Port's code.
Was doing that for Ninja's benefit (since he said he didn't know how with the code he had), by the way, not OP's. Just so you know. ;)

Was doing that for Ninja's benefit (since he said he didn't know how with the code he had), by the way, not OP's. Just so you know. ;)
But Port's says how to do it more efficiently.