[Solved] Filter 1 or more signals from a bunch of signals

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
DOSorDIE
Fast Inserter
Fast Inserter
Posts: 249
Joined: Sat Oct 11, 2014 3:43 pm
Contact:

[Solved] Filter 1 or more signals from a bunch of signals

Post by DOSorDIE »

I have a chest as example (later it will be a signal from my Smart Factory) and i want filter out 1 or more signal from it.
Something Like:
12 Iron, 19 Copper, 6 Steel, 9 Wood ---> will get only the 6 Steel and the 9 Wood.
Next time i must filter total different things of a another signal ...
But how i make that?
I filter the signal but only with 1 of it ... but i need the orginal number.

Please Help!
Help.jpg
Help.jpg (89.67 KiB) Viewed 4365 times
Last edited by DOSorDIE on Mon Jul 18, 2016 7:13 am, edited 1 time in total.

User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: Need Help: Filter 1 or more signals from a bunch of signals

Post by siggboy »

Here's a good solution for this problem: viewtopic.php?f=8&t=20732&start=60#p171258

It works like this: you have a bunch of "candidate signals" that you are interested in. These are the signal colors (types) you want to extract from the input signal.

You give each of the candidate signals a large value (e.g. 2 billion = 2,000,000,000), then you add this artificial large value to the original signal.

Let's say your original signal contained the value "Iron 1,234" and some rubbish that you're not interested in. You now add "Iron 2,000,000,000" to this, and the result is "Iron 2,000,001,234" (and the rubbish signals.)

Now comes the filtering step: you extract everything that is greater than "2,000,000,000" and the only thing that remains will be "Iron 2,000,001,234". The rubbish signals will be filtered out because they were too small.

In the last step you subtract the original "2,000,000,000" and you are left with your original "Iron 1,234" and nothing else.

It also works with multiple signals so you can make arbitrary filters.

Does that solve your problem?
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

DOSorDIE
Fast Inserter
Fast Inserter
Posts: 249
Joined: Sat Oct 11, 2014 3:43 pm
Contact:

Re: Need Help: Filter 1 or more signals from a bunch of signals

Post by DOSorDIE »

I have try it this ... and it works!
Thank you very much! :mrgreen:

Harkonnen604
Filter Inserter
Filter Inserter
Posts: 285
Joined: Thu Jun 09, 2016 5:56 am
Contact:

Re: [Solved] Filter 1 or more signals from a bunch of signals

Post by Harkonnen604 »

There is much easier way. Put arithmetic combinator for every item you want to filter out with +0 operation (e.g. stone+0 => stone), then gather their outputs. This plus-zero operation also allows to remap signals to different items/colors.
Attachments
filter.jpg
filter.jpg (93.8 KiB) Viewed 4314 times

User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: [Solved] Filter 1 or more signals from a bunch of signals

Post by siggboy »

Harkonnen604 wrote:There is much easier way. Put arithmetic combinator for every item you want to filter out with +0 operation
This is only easier if you know in advance what you want to filter, and if it's not a lot of signals (because you need 1 combinator per signal).

Obviously if all you care about is filtering "Copper Plate" from a bunch of signals, then the method you've described is much easier (only 1 combinator, and easier to understand).

The way I understood him, he needs a dynamic filter, so he has an unknown set of input signals, and he needs to apply a dynamic signal filter to it; so he could not follow your advice and program a couple of combinators in advance (that would be a static filter).
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

Harkonnen604
Filter Inserter
Filter Inserter
Posts: 285
Joined: Thu Jun 09, 2016 5:56 am
Contact:

Re: [Solved] Filter 1 or more signals from a bunch of signals

Post by Harkonnen604 »

Got it. Would be very good actually if combinators allowed treating red/green inputs separately and map them to operands. This way each-red * each-green -> each would allow masking out necessary materials.

DOSorDIE
Fast Inserter
Fast Inserter
Posts: 249
Joined: Sat Oct 11, 2014 3:43 pm
Contact:

Re: [Solved] Filter 1 or more signals from a bunch of signals

Post by DOSorDIE »

Im happy when you give me new input.
Filter 1 item out or get the info for 1 item is was not the problem.
I have make it with *1 to get only that or to filter make it negativ and sum it with the other.
I use that for my big dream ... near configless Smartfactorio, but i have many problems to solve :(
Attachments
Smart Self Sorting System.jpg
Smart Self Sorting System.jpg (130.03 KiB) Viewed 4266 times

Post Reply

Return to “Gameplay Help”