Combinators not behaving as expected

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
000
Burner Inserter
Burner Inserter
Posts: 5
Joined: Mon Dec 27, 2021 5:00 pm
Contact:

Combinators not behaving as expected

Post by 000 »

Or, Yet another combinator noob thread.

I can't get a combinator to behave the way I want, and since it doesn't work the way I expect, I have no idea how to even attempt what I want it to do.

Combinator A sends a signal from a larger circuit. This works as intended. The signal is `L = 1`
Combinator B read train contents. It is supposed to send a signal if, and only if, Green Circuits = 4k. The signal it sends is `Green Circuits = 1`
Combinator C reads both signals. It is set to `Everything = 1`. It sends a signal if this is true.

Currently, only A is sending its signal. Yet, C is also sending its signal, even though Combinator B is not sending.

I tried setting C to Each instead with no change.

How do I make C only send its signal if every single signal it's getting is 1?

quyxkh
Smart Inserter
Smart Inserter
Posts: 1028
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: Combinators not behaving as expected

Post by quyxkh »

Zero value signals are not sent at all. Everything = 1 means everything that isn't zero = 1. Anything = 0 will never match.

You can make both combinators send the same go-signal and fire only when your go signal is 2, or supply a second input to your current comparison, a constants box with L=1 and Circuits = 1, and match on Everything = 2.

edit: the only time you can detect a zero signal is when you explicitly refer to that signal's value, compare it to zero or multiply it by something or some such.

000
Burner Inserter
Burner Inserter
Posts: 5
Joined: Mon Dec 27, 2021 5:00 pm
Contact:

Re: Combinators not behaving as expected

Post by 000 »

Well this complicates matters.

I'd read that an absent signal is read as 0, so I thought that meant that combinator C would getting one signal at 1, and one signal at 0.

Does this mean signals are added together? Two signals at 1 will be read as one signal at 2?

Edit: Remembered sandbox exists. Looks like that is indeed the case. I can work with this.

Thanks for the help.

robot256
Filter Inserter
Filter Inserter
Posts: 596
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: Combinators not behaving as expected

Post by robot256 »

The Everything condition is certainly one of the less intuitive behaviors. You know which signals you are trying to send, and which are being sent as zero, but the combinator can't distinguish between L=0 and the other hundred signals you aren't using, which are also zero. If it checked them too, it would never fire.

This is why some circuits will apply an offset, like -1000000, so that a nonzero value can represent that this signal is important, but also zero items are present. Then it gets converted back with +1000000 later.

quyxkh
Smart Inserter
Smart Inserter
Posts: 1028
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: Combinators not behaving as expected

Post by quyxkh »

000 wrote:
Mon Dec 27, 2021 10:28 pm
Does this mean signals are added together? Two signals at 1 will be read as one signal at 2?
The way I have it is, the value of a signal on a wire is the sum of that signal's values on all connected output ports. Likewise, the value of a signal a device sees is the sum of that signal's values on all connected input ports.

Most devices have dual-use ports, both input and output, you can watch for instance an inserter wired to something neutral like an electric pole and set read-hold (or even read-pulse though that's more confusing to watch), enable-if everything < 0, it disables pickup as soon as it gets anything so it'll only ever pick one item off a belt. There's tricks you can do with this that come in handy sometimes.

Post Reply

Return to “Gameplay Help”