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

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
Peter34
Smart Inserter
Smart Inserter
Posts: 1100
Joined: Mon Nov 10, 2014 12:44 pm
Contact:

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

Post by Peter34 »

Where can I see how many Logistics Robots and Construction Robots I've got in my network, in total?

Koub
Global Moderator
Global Moderator
Posts: 7199
Joined: Fri May 30, 2014 8:54 am
Contact:

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

Post by Koub »

Mouse over a logistic chest, it will tell you how many robots in the same logistic network.
Koub - Please consider English is not my native language.

User avatar
SHiRKiT
Filter Inserter
Filter Inserter
Posts: 706
Joined: Mon Jul 14, 2014 11:52 pm
Contact:

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

Post 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).

Peter34
Smart Inserter
Smart Inserter
Posts: 1100
Joined: Mon Nov 10, 2014 12:44 pm
Contact:

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

Post 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.

Koub
Global Moderator
Global Moderator
Posts: 7199
Joined: Fri May 30, 2014 8:54 am
Contact:

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

Post by Koub »

Chances are you have some robots in a chest, or maybe you have picked some while removing a roboport that contained some, ...
Koub - Please consider English is not my native language.

Armed_Monkey
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri Apr 24, 2015 3:58 pm
Contact:

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

Post 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 :)

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

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

Post 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

DeamonEngineer
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu May 21, 2015 7:29 pm
Contact:

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

Post 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

Post Reply

Return to “Gameplay Help”