help with console

Post all other topics which do not belong to any other category.
Zyth
Burner Inserter
Burner Inserter
Posts: 9
Joined: Mon Apr 18, 2016 1:38 pm
Contact:

help with console

Post 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)
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: help with console

Post by prg »

Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
Zyth
Burner Inserter
Burner Inserter
Posts: 9
Joined: Mon Apr 18, 2016 1:38 pm
Contact:

Re: help with console

Post 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,
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: help with console

Post by prg »

Hover over a roboport with the mouse and run

Code: Select all

/c game.local_player.print(game.local_player.selected.name)
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
Zyth
Burner Inserter
Burner Inserter
Posts: 9
Joined: Mon Apr 18, 2016 1:38 pm
Contact:

Re: help with console

Post 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
Zyth
Burner Inserter
Burner Inserter
Posts: 9
Joined: Mon Apr 18, 2016 1:38 pm
Contact:

Re: help with console

Post by Zyth »

and that is the correct name the code returned the name roboport
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: help with console

Post 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?
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
Zyth
Burner Inserter
Burner Inserter
Posts: 9
Joined: Mon Apr 18, 2016 1:38 pm
Contact:

Re: help with console

Post by Zyth »

nope thats whats wierd, it just doesnt do anything but it acts like its trying to,
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: help with console

Post by prg »

Does unmodded logistic <-> construction work for you?
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
Zyth
Burner Inserter
Burner Inserter
Posts: 9
Joined: Mon Apr 18, 2016 1:38 pm
Contact:

Re: help with console

Post 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,
Zyth
Burner Inserter
Burner Inserter
Posts: 9
Joined: Mon Apr 18, 2016 1:38 pm
Contact:

Re: help with console

Post by Zyth »

https://gyazo.com/f7db8e6db5e31fad23cefc93287b499b
https://gyazo.com/b7cfee56e4bdc2508cd570ed71e62298
https://gyazo.com/a9e41cfd88464a53e48b6f38ce297366
^^ results of the code to find names,
https://gyazo.com/27d13428de11f52c8b596b0a979b04d0
^^result of the code, was nothing changed, my roboport was still full of vanilla construction robots,
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: help with console

Post by prg »

You need to actually execute that command with /c, like all the other commands.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
Zyth
Burner Inserter
Burner Inserter
Posts: 9
Joined: Mon Apr 18, 2016 1:38 pm
Contact:

Re: help with console

Post by Zyth »

omg am i really that dumb,,,
Zyth
Burner Inserter
Burner Inserter
Posts: 9
Joined: Mon Apr 18, 2016 1:38 pm
Contact:

Re: help with console

Post 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,
Post Reply

Return to “General discussion”