Page 1 of 1

Setting constant combinator signals

Posted: Thu Aug 18, 2016 6:34 pm
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

Re: Setting constant combinator signals

Posted: Thu Aug 18, 2016 7:00 pm
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
        },
    },
}

Re: Setting constant combinator signals

Posted: Thu Aug 18, 2016 8:08 pm
by piriform
thank you!


ps aargh!