Setting constant combinator signals

Place to get help with not working mods / modding interface.
Post Reply
piriform
Fast Inserter
Fast Inserter
Posts: 117
Joined: Mon Jan 25, 2016 10:02 pm
Contact:

Setting constant combinator signals

Post by piriform »

I'm hoping that somebody can help me with a problem I'm having in setting multiple signals in a constant combinator. To set a single signal (try saying that quickly :lol: ) I'm using something like this:

Code: Select all

local x= -22.5;
local y = 96.5;
local cc = game.surfaces[1].find_entity('constant-combinator',{x,y});
if cc.name == "constant-combinator" then 
	local setcc = cc.get_or_create_control_behavior();
	setcc.parameters	={parameters ={{signal ={type = "item",name = "iron-plate"},count = 11,index = 1}}};				
end;
This works. My problem is I need to set multiple signals. So I tried different variations on this:

Code: Select all

setcc.parameters=	{{parameters ={{signal ={type = "item",name = "iron-plate"},count = 11,index = 1}}},				
			{parameters ={{signal ={type = "item",name = "copper-plate"},	count = 22,index = 2}}}};
Unsurprisingly (given my Lua noobishness), that did not.
If anyone has any pointers, I'd be grateful

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

Re: Setting constant combinator signals

Post by prg »

Just indent things properly so you can see what you're actually doing there.

Code: Select all

{
    parameters =
    {
        {
            signal =
            {
                type = "item",
                name = "iron-plate"
            },
            count = 11,
            index = 1
        },
        {
            signal =
            {
                type = "item",
                name = "copper-plate"
            },
            count = 22,
            index = 2
        },
    },
}
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

piriform
Fast Inserter
Fast Inserter
Posts: 117
Joined: Mon Jan 25, 2016 10:02 pm
Contact:

Re: Setting constant combinator signals

Post by piriform »

thank you!


ps aargh!

Post Reply

Return to “Modding help”