New combinator logic: Output any TRUE condition as 1

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

New combinator logic: Output any TRUE condition as 1

Post by 000 »

Thanks to the new logic in combinators, it is possible for one combinator to have multiple conditions. In theory, this should allow one combinator to perform a function previously performed by many.

I am looking for a way to have a single combinator set filters on an inserter, where the filters are the signal type (the item) of the conditions on the combinator, not the input signals themselves.

I think I might be looking for EACH output, but that is inexplicably not an option. I have tried both EVERYTHING and ANYTHING to no avail. In fact, both of these modes do the exact opposite of what I want.

In the attached screenshot, I have one storage chest containing 100 Repair Packs. This chest is wired to the input of the combinator. This combinator's output is wired to an inserter. The inserter has "set filters" enabled.

The logic on the combinator...

Input:
If Substation < 10
OR
If Wall < 100
OR
If Repair Pack < 100

Output: ANYTHING = 1

The only input signal is Repair Pack at 100. The combinator is outputting Repair Pack at 1. I suspect this is because it is simply outputting its input signals. Switching from ANYTHING to EVERYTHING does not change this behaviour.

Desired behaviour: Output only the TRUE conditions, Substation and Wall, at 1.

Here is a blueprint string:

Code: Select all

0eNp9U9FuqzAM/Rc/h6mldGuR9iVThQK4rXUhYYnTDVX8+xzYuq7l9g07Psc+x+YMZROwc2QY8jNQZY2H/O0Mng5GNzFndIuQQ40V1eiSyrYlGc3WwaCATI2fkC8HNQPxUqQPmFRH9HxVnQ47BWiYmHDqNgZ9YUJbohM69aCrgs56gVoTWwndy2rxtFbQQ568rLbSRkSws01R4lGfSCBS901UyFs9gn3MXkcyxp6c5+JeRyg967HjxC5R9Gu5iLL/B2JrMPnQTXMLeoRy2GlySaerf/cwcc0G7gLfroj7LoJP5DhI5uLeVJFo0/ORzGFi7HoxIRgu9s62BRnhg3yvG4/DbhjibDfbSC98e+05IePRMc4uYnm1iKe1tKvJYTWVZPOLqchVgcQKlImoEWJRxy6goC+xqP25NDVnlYJ3ES5DS95Y144myM102o03k8MrRPuCx9smd3JXav5+H8vdjHIfCbzcWoFGlw3WP64rkfIepMXvaLLcyba/2uOCRMWHmBof3pYqVSuV7pR8ZfKd7uSVGFsZ/ve/VnAS0nHu9XO6zbbb9SZbpItsMwxfpcVgDw==
My questions:

Why is EACH not an option for output? I ask out of curiosity even if it is not relevant to my problem.

Would EACH output do what I want?

If not, how do I get my desired outputs with only one combinator? I know how to do this with as many combinators as desired signals, but I am sepecifically trying to avoid that: My eventual goal is forty signals, which is a lot of combinators.
Attachments
factorio combinator EACH.png
factorio combinator EACH.png (355.19 KiB) Viewed 287 times
jdrexler75
Fast Inserter
Fast Inserter
Posts: 178
Joined: Sat Nov 28, 2020 5:27 pm
Contact:

Re: New combinator logic: Output any TRUE condition as 1

Post by jdrexler75 »

"Each" is an output option when there is an input with "each". Otherwise "each" could not match any signal to output.

The way I solve this situation, is with a constant combinator box that sets the negative value of your desired condition, in your case Substation=-10, Wall=-100, Repair Pack=-100. Then connect this to the decider and just use the condition "Each < 0".

You might think that you could get away without the constants, by just doing "Each = Wall and Wall<100", but the "Each = Wall" does not check the signal type (Wall), but only the signal value (e.g. 98). But if you also have 98 repair packs, then Each = Wall would be true for repair packs as well because they have the same value. This is why you need a separate signal source to provide the distinction.

(Alternative ways if you don't want the slightly unintuitive negative values, would be to connect the constant to a separate color input, i.e. red vs. green, and use "Each(green) < Each(red)" instead, but I prefer the flexibility of not enforcing separate colors, when I later need to add more signals that shouldn't mix.)
Amarula
Filter Inserter
Filter Inserter
Posts: 686
Joined: Fri Apr 27, 2018 1:29 pm
Contact:

Re: New combinator logic: Output any TRUE condition as 1

Post by Amarula »

I put the actual signals on green, and the constants from the constant combinator on the red wire. Then I check the value on the green wire, is it what I want or not, and AND it with EACH on the red wire to select which signal to output as EACH. Note the constant values have to be distinct because the test only looks at the signal value, not at the signal. Here is an example, I hope it helps.
Lamp status display.png
Lamp status display.png (113.76 KiB) Viewed 223 times
My own personal Factorio super-power - running out of power.
Tertius
Smart Inserter
Smart Inserter
Posts: 1636
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: New combinator logic: Output any TRUE condition as 1

Post by Tertius »

It's a bit difficult to understand what you want as output. It seems you want to get every signal where its corresponding value is below a given threshold. For every signal you want its own special threshold.
Or with other words: create a list of signals of everything that's too low, suited as filter in some inserter.

You use the EACH wildcard for this.

In a constant combinator, set the thresholds you want. In your case:
05-03-2026, 17-32-29.png
05-03-2026, 17-32-29.png (40.34 KiB) Viewed 212 times
Now the combinator magic. Connect the constant combinator with red wire, and the other wire to your inventory signal. Now we can compare the content of the constant combinator (our thresholds) with the current inventory value.

EACH(green) < EACH(red)
This builds an internal list of all signals where the condition matches. It selects every signal with inventory amount < threshold.

In the output, we again use EACH and this runs over the internally created list of matching signals. We choose to output 1, so this can be used as filter in an inserter.

About the 2nd condition in the combinator EACH(red) <> 0: this is a safeguard against filter poisoning. Eligible for output to the inserter filter are just items configured in the constant combinator. If omitted, the EACH < EACH above would also trigger for negative values in the inventory, which could happen if you connect a roboport. Or just accidentally supply negative values from wherever.
05-03-2026, 17-39-30.png
05-03-2026, 17-39-30.png (143.96 KiB) Viewed 212 times

This combinator concept is called "filter".
Post Reply

Return to “Gameplay Help”