Page 1 of 1
help with console
Posted: Mon Apr 18, 2016 1:44 pm
by Zyth
looking for more info on using the console commands, i have the bobs mod for better logistic robots, but i already have over 26k standard ones and over 500 robo ports so going to each one to remove any vanila robots isnt an option, is there a command/commands i could run to kill off all flying and or docked vanila robots, something better than the best i could do wich didnt work /c game.forces["neutral"].kill_all_units(construction-robot)
Re: help with console
Posted: Mon Apr 18, 2016 2:14 pm
by prg
Re: help with console
Posted: Mon Apr 18, 2016 6:10 pm
by Zyth
this is usefull except for one thing the bobs logistics changes the names of the roboports so it cant find the inventory and i dont no how to find the new name,
Re: help with console
Posted: Mon Apr 18, 2016 6:12 pm
by prg
Hover over a roboport with the mouse and run
Code: Select all
/c game.local_player.print(game.local_player.selected.name)
Re: help with console
Posted: Mon Apr 18, 2016 6:18 pm
by Zyth
attemped this, didnt work, any help would be apprieciated
Code: Select all
local original = "construction-robot"
local replacement = "bob-construction-robot-4"
local s = game.local_player.surface
for chunk in s.get_chunks() do
local entities = s.find_entities_filtered{name="roboport", area={{chunk.x*32, chunk.y*32}, {(chunk.x+1)*32, (chunk.y+1)*32}}}
for _, entity in pairs(entities) do
local inv = entity.get_inventory(1)
local count = inv.get_contents()[original]
if count then
inv.remove{name=original, count=count}
inv.insert{name=replacement, count=count}
end
Re: help with console
Posted: Mon Apr 18, 2016 6:19 pm
by Zyth
and that is the correct name the code returned the name roboport
Re: help with console
Posted: Mon Apr 18, 2016 6:34 pm
by prg
With this code I can turn construction robots that are sitting in roboports into logistic robots and vice-versa just fine. Those are unmodded though. Any kind of error message?
Re: help with console
Posted: Mon Apr 18, 2016 6:41 pm
by Zyth
nope thats whats wierd, it just doesnt do anything but it acts like its trying to,
Re: help with console
Posted: Mon Apr 18, 2016 6:45 pm
by prg
Does unmodded logistic <-> construction work for you?
Re: help with console
Posted: Mon Apr 18, 2016 6:47 pm
by Zyth
tried this
Code: Select all
local original = "construction-robot"
local replacement = "logistic-robot"
local s = game.local_player.surface
for chunk in s.get_chunks() do
local entities = s.find_entities_filtered{name="roboport", area={{chunk.x*32, chunk.y*32}, {(chunk.x+1)*32, (chunk.y+1)*32}}}
for _, entity in pairs(entities) do
local inv = entity.get_inventory(1)
local count = inv.get_contents()[original]
if count then
inv.remove{name=original, count=count}
inv.insert{name=replacement, count=count}
end
end
end
didnt work eithr,
Re: help with console
Posted: Mon Apr 18, 2016 6:49 pm
by Zyth
Re: help with console
Posted: Mon Apr 18, 2016 6:54 pm
by prg
You need to actually execute that command with /c, like all the other commands.
Re: help with console
Posted: Mon Apr 18, 2016 6:56 pm
by Zyth
omg am i really that dumb,,,
Re: help with console
Posted: Mon Apr 18, 2016 6:58 pm
by Zyth
thank you so much, it never occoured to me to check if the /c was at the start of the code, i feel really dumb now,