Page 1 of 1

Where can I see how many Robots are in my network?

Posted: Thu Apr 16, 2015 2:46 am
by Peter34
Where can I see how many Logistics Robots and Construction Robots I've got in my network, in total?

Re: Where can I see how many Robots are in my network?

Posted: Thu Apr 16, 2015 5:38 am
by Koub
Mouse over a logistic chest, it will tell you how many robots in the same logistic network.

Re: Where can I see how many Robots are in my network?

Posted: Thu Apr 16, 2015 11:02 pm
by SHiRKiT
Koub wrote:Mouse over a logistic chest, it will tell you how many robots in the same logistic network.
That means:
- Any logistic robot
- Construction robots that currently have a job.

Read this carefully so you can understand that one can only know how many construction robots are there in a network by issuing a huge job (like destroying 2 chests full of stuff).

Re: Where can I see how many Robots are in my network?

Posted: Fri Apr 17, 2015 6:39 am
by Peter34
Koub wrote:Mouse over a logistic chest, it will tell you how many robots in the same logistic network.
I already did that. It showed me a figure of 50, which is suspiciously round, and also far lower than what I expected.

Re: Where can I see how many Robots are in my network?

Posted: Fri Apr 17, 2015 8:21 pm
by Koub
Chances are you have some robots in a chest, or maybe you have picked some while removing a roboport that contained some, ...

Re: Where can I see how many Robots are in my network?

Posted: Fri Apr 24, 2015 4:18 pm
by Armed_Monkey
You can use these lua codes to get the "active" count of bots.

/c game.player.print(game.player.force.getentitycount("logistic-robot"))
/c game.player.print(game.player.force.getentitycount("construction-robot"))

These commands do not count the bots that are in storage/robo-ports.
Hope it helps :)

Re: Where can I see how many Robots are in my network?

Posted: Fri Apr 24, 2015 5:35 pm
by DaveMcW
If we're throwing lua at the problem, you can use this. It counts all active and inactive robots in the network, but misses the ones flying over gaps in coverage.

Code: Select all

/c robots = {};
roboports = {};
logistic = 0;
construction = 0;
recurse = function(r)
   id = r.position.x .. "," .. r.position.y;
   if (roboports[id] or r.force.name ~= game.player.force.name) then return end;
   roboports[id] = true;
   logistic = logistic + r.getinventory(1).getitemcount("logistic-robot");
   construction = construction + r.getinventory(1).getitemcount("construction-robot");
   ids = {};
   for _, robot in ipairs(game.findentitiesfiltered{area={{r.position.x-50, r.position.y-50}, {r.position.x+50, r.position.y+50}}, name="construction-robot"}) do;
      id = robot.position.x .. "," .. robot.position.y;
      if ((ids[id] or not robots[id]) and robot.force.name == game.player.force.name) then;
         construction = construction + 1;
         ids[id] = true;
         robots[id] = true;
      end;
   end;
   for _, robot in ipairs(game.findentitiesfiltered{area={{r.position.x-50, r.position.y-50}, {r.position.x+50, r.position.y+50}}, name="logistic-robot"}) do;
      id = robot.position.x .. "," .. robot.position.y;
      if ((ids[id] or not robots[id]) and robot.force.name == game.player.force.name) then;
         logistic = logistic + 1;
         ids[id] = true;
         robots[id] = true;
      end;
   end;
   for _, roboport in ipairs(game.findentitiesfiltered{area={{r.position.x-48.5, r.position.y-48.5}, {r.position.x+48.5, r.position.y+48.5}}, name="roboport"}) do;
      recurse(roboport);
   end;
end;
p = game.player.character.position;
roboport = game.findentitiesfiltered{area={{p.x-48.5, p.y-48.5}, {p.x+48.5, p.y+48.5}}, name="roboport"}[1];
if (roboport) then;
   recurse(roboport);
   game.player.print("Robots in network: Construction:" .. construction .. " Logistic:" .. logistic);
else;
   game.player.print("Not in range of a roboport.");
end

Re: Where can I see how many Robots are in my network?

Posted: Thu May 21, 2015 9:04 pm
by DeamonEngineer
This script was made by a streaming friend of mine to help out my stream goal of 1k bots per follower, the only thing this script doesnt include is bots held on inserters. Check out my stream at www.twitch.com/DeamonEngineer

Code: Select all

/c 
local ls,cs="logistic-robot","construction-robot";
local log,con = game.forces.player.getentitycount(ls),game.forces.player.getentitycount(cs);
for c in game.getchunks() do
 for _,port in pairs(game.findentitiesfiltered{area={{c.x*32,c.y*32},{c.x*32+32,c.y*32+32}}}) do
 con=con+port.getitemcount(cs);
 log=log+port.getitemcount(ls) end end
 for _,p in pairs(game.players) do p.print(con..cs..", "..log..ls) end
All credit of this script is Loren1350