explain some console commands

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Offsetpeter
Burner Inserter
Burner Inserter
Posts: 6
Joined: Thu Apr 28, 2016 9:54 pm
Contact:

explain some console commands

Post by Offsetpeter »

i am trying to use the console command to add a resources patch but i dont understand the wikipedia

/c local surface = game.local_player.surface;
for y=-2,2 do
for x=-2,2 do
surface.create_entity({name="stone", amount=5000, position={game.local_player.position.x+x, game.local_player.position.y+y}})
end
end

can someone tell me how to correctly insert this in the console command

thank you

-Offsetpeter
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: explain some console commands

Post by prg »

Open console with ~ or whatever you might have configured, ctrl+v, enter.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
Offsetpeter
Burner Inserter
Burner Inserter
Posts: 6
Joined: Thu Apr 28, 2016 9:54 pm
Contact:

Re: explain some console commands

Post by Offsetpeter »

prg wrote:Open console with ~ or whatever you might have configured, ctrl+v, enter.
i know that yes but the command it self

Add new resource patch
This creates a new 5x5 patch of resources, centered on the player character. For resources other than stone, just change "stone" to "iron-ore", "copper-ore", or "coal"

/c local surface = game.local_player.surface;
for y=-2,2 do
for x=-2,2 do
surface.create_entity({name="stone", amount=5000, position={game.local_player.position.x+x, game.local_player.position.y+y}})
end
end


is what i dont understand
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: explain some console commands

Post by prg »

Could you rephrase your question? I have no idea what your problem is with this command then. You want a line by line explanation of how it works?
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
Offsetpeter
Burner Inserter
Burner Inserter
Posts: 6
Joined: Thu Apr 28, 2016 9:54 pm
Contact:

Re: explain some console commands

Post by Offsetpeter »

if you want yes please
let me ask it like this

for example what do i need to put in the console command if i want a 5x5 iron ore deposit
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3749
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: explain some console commands

Post by DaveMcW »

/c local surface = game.local_player.surface;
for y=-2,2 do
for x=-2,2 do
surface.create_entity({name="iron-ore", amount=5000, position={game.local_player.position.x+x, game.local_player.position.y+y}})
end
end
Offsetpeter
Burner Inserter
Burner Inserter
Posts: 6
Joined: Thu Apr 28, 2016 9:54 pm
Contact:

Re: explain some console commands

Post by Offsetpeter »

so if i copy paste this :

/c local surface = game.local_player.surface;
for y=-2,2 do
for x=-2,2 do
surface.create_entity({name="iron-ore", amount=5000, position={game.local_player.position.x+x, game.local_player.position.y+y}})
end
end

it wil give me a 5x5 iron ore patch ??
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: explain some console commands

Post by prg »

If only there was a way to find out...
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
Offsetpeter
Burner Inserter
Burner Inserter
Posts: 6
Joined: Thu Apr 28, 2016 9:54 pm
Contact:

Re: explain some console commands

Post by Offsetpeter »

so no that dose not work
Attachments
Naamloos.png
Naamloos.png (2.25 MiB) Viewed 4504 times
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: explain some console commands

Post by prg »

You have a stray ` at the end.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
Offsetpeter
Burner Inserter
Burner Inserter
Posts: 6
Joined: Thu Apr 28, 2016 9:54 pm
Contact:

Re: explain some console commands

Post by Offsetpeter »

prg wrote:You have a stray ` at the end.
nice that workt thank you
Sub
Manual Inserter
Manual Inserter
Posts: 2
Joined: Mon Aug 08, 2016 8:01 pm
Contact:

Re: explain some console commands

Post by Sub »

Bez tytułu.png
Bez tytułu.png (2.21 MiB) Viewed 4290 times
i have this problem pleas help
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: explain some console commands

Post by prg »

Nowadays it's just player instead of local_player.

Also for crude oil you probably want to add some spacing so you're able to place the pumpjacks. Try {game.player.position.x+3*x, game.player.position.y+3*y} as the position.

edit: ...better use at least one 4 there somewhere if you also care about pipes.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
Sub
Manual Inserter
Manual Inserter
Posts: 2
Joined: Mon Aug 08, 2016 8:01 pm
Contact:

Re: explain some console commands

Post by Sub »

thank you so much.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: explain some console commands

Post by ssilk »

1. This is moved from General to Gameplay Help
2. Please use the code-block to show code.

Code: Select all

/c local surface = game.local_player.surface;
for y=-2,2 do
for x=-2,2 do
surface.create_entity({name="iron-ore", amount=5000, position={game.local_player.position.x+x, game.local_player.position.y+y}})
end
end
Looks much better than
/c local surface = game.local_player.surface;
for y=-2,2 do
for x=-2,2 do
surface.create_entity({name="iron-ore", amount=5000, position={game.local_player.position.x+x, game.local_player.position.y+y}})
end
end

and avoids wrong quoting.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Post Reply

Return to “Gameplay Help”