[0.17.x] Filter inserter blacklist and circuit network - How to ?

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
User avatar
SeigneurAo
Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Tue Oct 18, 2016 11:13 am
Contact:

[0.17.x] Filter inserter blacklist and circuit network - How to ?

Post by SeigneurAo »

Hello.

I'd like a filter inserter to grab all objects in a container, except those sent by circuit network signals with the "Set filters" option selected on the inserter. I tried positive values, negative values, whitelist, blacklist... Nothing seems to achieve that.
Am I doing something wrong, or is it simply not possible ?

Thanks in advance !
User avatar
SeigneurAo
Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Tue Oct 18, 2016 11:13 am
Contact:

Re: [0.17.x] Filter inserter blacklist and circuit network - How to ?

Post by SeigneurAo »

Further testing, and it seems that the "Set filters" option only takes one signal into account (which one ? Couldn't tell).
It's a pity you can't have a blacklist that would actually be a list, and not a single item.
Any guidance is very much welcome, I might have overlooked something obvious :)
astroshak
Filter Inserter
Filter Inserter
Posts: 637
Joined: Thu May 10, 2018 9:59 am
Contact:

Re: [0.17.x] Filter inserter blacklist and circuit network - How to ?

Post by astroshak »

IIRC Filter Inserters can have up to 5 filters set. Stack Filter Inserters only one.

You can change them via combinators.

But, and here’s the kicker for you : its a Whitelist, not a Blacklist. Both types of filter inserters only move the stuff set by their filter.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1725
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: [0.17.x] Filter inserter blacklist and circuit network - How to ?

Post by Pi-C »

SeigneurAo wrote: Sun Mar 10, 2019 12:58 pm Hello.

I'd like a filter inserter to grab all objects in a container, except those sent by circuit network signals
Say you want to grab everything but iron ore and copper plates:
  1. Set up a constant combinator. Add signals IRON ORE and COPPER PLATES, each set to 1. (Blacklist)
  2. Connect an arithmetic combinator to the constant combinator. Set the condition to "EACH * -1". (Blacklist)
  3. Connect an decider combinator to the container. Set the condition to "EACH > 0 --> OUTPUT 1". (Read container contents)
  4. Add another decider combinator. Connect output of the arithmetic combinator and the first decider combinator to input of this one. Set condition to "EACH > 0 --> OUTPUT EACH 1".
    Actually, you could also use "OUTPUT Input count" here because we have made sure previously that this decider combinator receives only signals with count 1 or 0.
    (Remove blacklisted items from filter list)
  5. Put a filter inserter next to the container and connect it to the output of the second decider combinator. The inserter has now a menu "Circuit connection". Set "Mode of operation" there to "Set filters". Now, everything but iron ore and copperplates should be removed from the container.
(By the way: The arithmetic combinator from step 2 could be omitted if you set all signals in the constant combinator to -1 directly. I believe using the additional combinator reduces work, though. In constant combinators, the default value for newly added signals is 1. If you want to set them to -1, you have to manually adjust the default value of each signal. That may not be a problem when you only want to blacklist two items, but if you have a list of five or more, you will appreciate not having to do that manually. :-))

That's what I would have done in 0.16.51. While setting up an MWE right now, I noticed that things have become much easier in 0.17:
  1. Set up a constant combinator. Add signals IRON ORE and COPPER PLATES, each set to 1.
  2. Put a filter inserter next to the container and connect it to the output of the second decider combinator. The inserter has now a menu "Circuit connection". Set "Mode of operation" there to "Set filters". On the left side, move the switch from "Whitelist" to "Blacklist". Now, everything but iron ore and copperplates should be removed from the container.
I just tried out both setups and wanted to post a blueprint here. Creating the blueprint was no problem, but now I have no idea how I can export the blueprint string. That's quite embarrassing, can anybody help me out, please? :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
User avatar
SeigneurAo
Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Tue Oct 18, 2016 11:13 am
Contact:

Re: [0.17.x] Filter inserter blacklist and circuit network - How to ?

Post by SeigneurAo »

Pi-C wrote: Sun Mar 10, 2019 4:47 pm That's what I would have done in 0.16.51. While setting up an MWE right now, I noticed that things have become much easier in 0.17:
  1. Set up a constant combinator. Add signals IRON ORE and COPPER PLATES, each set to 1.
  2. Put a filter inserter next to the container and connect it to the output of the second decider combinator. The inserter has now a menu "Circuit connection". Set "Mode of operation" there to "Set filters". On the left side, move the switch from "Whitelist" to "Blacklist". Now, everything but iron ore and copperplates should be removed from the container.
I just tried out both setups and wanted to post a blueprint here. Creating the blueprint was no problem, but now I have no idea how I can export the blueprint string. That's quite embarrassing, can anybody help me out, please? :-)
That's the expected behaviour, at least the one I did expect to see.
What it actually does, is that it only takes one of the signals into account, not both.
I did what you said, and the inserter moved absolutely everything except Copper plates. It did move the Iron ores regardless of the constant combinator telling it not to, just like my first attempts.
Why it acknowledges only one of the two signals, and which of the two, I have no clue. What I know is that, right now, blacklisting several items doesn't seem possible out of the box.

In the end, I managed with a whitelist and dynamic signals : the whitelist, same as the blacklist, only registers one signal from the circuit network.
So I dynamically assign signals to the network, and remove them once the item is cleared from the origin. Then the inserter takes the "next" item (still don't know in which order, but it doesn't matter much), I remove the signal once done, and so on...
Bit more trickier, bit more far fetched, but it does the job. Not so convenient as a blacklist and, I believe, less versatile, but if fits my needs for now.

I'm unsure if it's a bug at this point, guess I'll have to wait and hope for the staff to see this thread eventually. Oh well ^^
User avatar
SeigneurAo
Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Tue Oct 18, 2016 11:13 am
Contact:

Re: [0.17.x] Filter inserter blacklist and circuit network - How to ?

Post by SeigneurAo »

Ok I got it.
What you describe works with the regular Filter inserter (and I mentioned just that in the title of my post, to be fair), but I was trying to get it to work with a Stack filter inserter, which doesn't seem to be possible, according to the Wiki and as astroshak mentioned.
Quite disappointing, seeing that it's supposedly an upgrade from the filter inserter...
quyxkh
Smart Inserter
Smart Inserter
Posts: 1031
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: [0.17.x] Filter inserter blacklist and circuit network - How to ?

Post by quyxkh »

It's easy: greenwire a constant combinator and your chest to the stack filter inserter. Set the inserter to "set filters" mode. Anything you want to stay in the chest, set a constant -1000000 in the combinator. Filters are only set from positive signals, so just ensure the signal for anything you don't want taken stays negative.
User avatar
SeigneurAo
Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Tue Oct 18, 2016 11:13 am
Contact:

Re: [0.17.x] Filter inserter blacklist and circuit network - How to ?

Post by SeigneurAo »

quyxkh wrote: Sun Mar 10, 2019 5:26 pm It's easy: greenwire a constant combinator and your chest to the stack filter inserter. Set the inserter to "set filters" mode. Anything you want to stay in the chest, set a constant -1000000 in the combinator. Filters are only set from positive signals, so just ensure the signal for anything you don't want taken stays negative.
Yes, but the original aim was to have a filter on multiple objects, which doesn't seem possible with a blacklist on a stack filter inserter.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1725
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: [0.17.x] Filter inserter blacklist and circuit network - How to ?

Post by Pi-C »

SeigneurAo wrote: Sun Mar 10, 2019 5:12 pm Ok I got it.
What you describe works with the regular Filter inserter (and I mentioned just that in the title of my post, to be fair), but I was trying to get it to work with a Stack filter inserter, which doesn't seem to be possible, according to the Wiki and as astroshak mentioned.
Quite disappointing, seeing that it's supposedly an upgrade from the filter inserter...
Yes, that has bothered me, too. But seriously, who would actually use filter inserters later in the game if stack filter inserters could filter for more than one item? They would have no use at all -- now, if only they were an ingredient for stack filter inserters (why not stack inserter + filter inserter or fast inserter + filter inserter instead of just a stack inserter), then it would be a different matter. Now, however, there is a specific use case for normal filter inserters, so that should be OK.

Having just one filter on stack filter inserters makes sense from a different perspective as well: When do you use stack inserters? If you expect them to move many items of the same type! Setting many filters implies that you expect a great variety of items. Stack filter inserters could still be useful there if they move items from a chest or assembler, but I guess (yeah, I'm really not sure!) they would fail at removing stuff from a stalled sushi belt: They would set a filter, wait (in vain) until they have grabbed a stack of one item to move before they could filter for the next item. Normal filter inserters are more flexible because they move only a very limited amount of items at any time.

So, to sum it up, having a limit to the filtering capabilities of stack filter inserters is a nuisance, but it is there for a good reason. :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Pi-C
Smart Inserter
Smart Inserter
Posts: 1725
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: [0.17.x] Filter inserter blacklist and circuit network - How to ?

Post by Pi-C »

SeigneurAo wrote: Sun Mar 10, 2019 6:15 pm
quyxkh wrote: Sun Mar 10, 2019 5:26 pm It's easy: greenwire a constant combinator and your chest to the stack filter inserter. Set the inserter to "set filters" mode. Anything you want to stay in the chest, set a constant -1000000 in the combinator. Filters are only set from positive signals, so just ensure the signal for anything you don't want taken stays negative.
Yes, but the original aim was to have a filter on multiple objects, which doesn't seem possible with a blacklist on a stack filter inserter.
It should work because both chest and constant combinator are connected to the stack filter inserter. The chest itself sends EACH<>0 to the inserter, and the inserter sets the filter for EACH>0 (successively). As 1000000 is subtracted from the amount of blacklisted items, the inserter will always (well, unless you have some modded crazy stack sizes so more than 1000000 items fit into a chest) see a negative signal for them and always ignore these items. It can only set one filter at a time, but once all items of one kind have been removed from the chest, its value will be 0, so the chest won't send it and the inserter would change the filter to the next item.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
User avatar
SeigneurAo
Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Tue Oct 18, 2016 11:13 am
Contact:

Re: [0.17.x] Filter inserter blacklist and circuit network - How to ?

Post by SeigneurAo »

Pi-C wrote: Sun Mar 10, 2019 6:22 pm Having just one filter on stack filter inserters makes sense from a different perspective as well: When do you use stack inserters? If you expect them to move many items of the same type! Setting many filters implies that you expect a great variety of items. Stack filter inserters could still be useful there if they move items from a chest or assembler, but I guess (yeah, I'm really not sure!) they would fail at removing stuff from a stalled sushi belt: They would set a filter, wait (in vain) until they have grabbed a stack of one item to move before they could filter for the next item. Normal filter inserters are more flexible because they move only a very limited amount of items at any time.
The use case is : emptying a "garbage" cargo wagon with mixed items, some I want to keep in the train, some which should go into an active provider chest for long term storage. The stack filter inserter empties the wagon of items that are not on a "keep" list (constant combinator) in the active provider.
The train collects miscellaneous items from outposts and brings it back to the base. But the train also carries "utilitary" stuff which I want kept it. Having a dedicated garbage wagon is something I considered but it's not that easy since train stops have different length, also I wanted to mess a bit with circuit network (I usually find excuses to do so, heh :-P).

Pi-C wrote: Sun Mar 10, 2019 6:35 pmIt should work because both chest and constant combinator are connected to the stack filter inserter. The chest itself sends EACH<>0 to the inserter, and the inserter sets the filter for EACH>0 (successively). As 1000000 is subtracted from the amount of blacklisted items, the inserter will always (well, unless you have some modded crazy stack sizes so more than 1000000 items fit into a chest) see a negative signal for them and always ignore these items. It can only set one filter at a time, but once all items of one kind have been removed from the chest, its value will be 0, so the chest won't send it and the inserter would change the filter to the next item.
This is actually quite similar to the solution I finally picked : a constant combinator emits a list of "wanted" items and their quantity. Substracting that from the actual content of the train gives both positive and negative values : I send the positive ones on the green circuit (items should be kept, or even refilled), and I send the negative ones on the red circuit, turning them positive beforehand. These values are fed to the stack filter inserter with a whitelist and "set filters" mode, so that it empties the wagon of unwanted items, one category at a time. When the first one is finished, the signal becomes 0/null and disappears from the circuit network, the inserter can then handle the next one in line, and so on until there are no more signals.
Bit complicated (too much so ?), but I'm quite proud of the outcome, all in all.

The nice side effect is that it prevents this damned inserter behaviour where it stays extended on the railway holding an item if the train leaves suddenly, which sucks if you have multiple items in a given chest, since the inserter won't be able to do anything until it can rid itself of the item it's holding.

Oh, circuit networks and trains, gotta love 'em.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1725
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: [0.17.x] Filter inserter blacklist and circuit network - How to ?

Post by Pi-C »

SeigneurAo wrote: Sun Mar 10, 2019 7:57 pm The use case is : emptying a "garbage" cargo wagon with mixed items, some I want to keep in the train, some which should go into an active provider chest for long term storage. The stack filter inserter empties the wagon of items that are not on a "keep" list (constant combinator) in the active provider.
The train collects miscellaneous items from outposts and brings it back to the base. But the train also carries "utilitary" stuff which I want kept it. Having a dedicated garbage wagon is something I considered but it's not that easy since train stops have different length, also I wanted to mess a bit with circuit network (I usually find excuses to do so, heh :-P).
Reminds me of my futile attempts to setup an on-demand supply loading station. Stuff got requested by a requester chest and distributed from there to the loading bay. However, to account for the gap between leaving requester and arriving at loading chest, I also counted all items that were on the belt. You don't want filter inserters to move a couple houndred belts or walls -- but sometimes the stack filter inserters stalled because they had been set to items that were still on the belt and couldn't be moved into the loading chests (and from there to the train) because these were still full …
Pi-C wrote: Sun Mar 10, 2019 6:35 pmIt should work because both chest and constant combinator are connected to the stack filter inserter. The chest itself sends EACH<>0 to the inserter, and the inserter sets the filter for EACH>0 (successively). As 1000000 is subtracted from the amount of blacklisted items, the inserter will always (well, unless you have some modded crazy stack sizes so more than 1000000 items fit into a chest) see a negative signal for them and always ignore these items. It can only set one filter at a time, but once all items of one kind have been removed from the chest, its value will be 0, so the chest won't send it and the inserter would change the filter to the next item.
This is actually quite similar to the solution I finally picked : a constant combinator emits a list of "wanted" items and their quantity. Substracting that from the actual content of the train gives both positive and negative values : I send the positive ones on the green circuit (items should be kept, or even refilled), and I send the negative ones on the red circuit, turning them positive beforehand. These values are fed to the stack filter inserter with a whitelist and "set filters" mode, so that it empties the wagon of unwanted items, one category at a time. When the first one is finished, the signal becomes 0/null and disappears from the circuit network, the inserter can then handle the next one in line, and so on until there are no more signals.
Bit complicated (too much so ?), but I'm quite proud of the outcome, all in all.
Basically the same, just reversed. Quyxkh's solution is more elegant because it's achieving the same result while using less resources (combinators/wires) and operations. On the other hand, every solution that works is valid, and finding one all on one's own is very satisfying. :-D
As 1000000 is subtracted from the amount of blacklisted items, the inserter will always (well, unless you have some modded crazy stack sizes so more than 1000000 items fit into a chest) […]
By the way, I've seen no container with a storage capacity of >1000000 yet, but I have the cargo ships mod installed. It includes waterways (the ships are modded trains, so the waterways work just like rails) that stack at 1000 pieces, and the cargo ships have 1000 slots. 1000000-1000000 is still 0, so quyxkh's solution would still work in this case -- but only barely! Just imagine the mod author decides to have a super cargo ship with 1500 slots full of water ways, the circuit logic would be broken. So we should scale up and subtract 10^7 instead of 10^6. :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
User avatar
SeigneurAo
Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Tue Oct 18, 2016 11:13 am
Contact:

Re: [0.17.x] Filter inserter blacklist and circuit network - How to ?

Post by SeigneurAo »

Pi-C wrote: Sun Mar 10, 2019 8:42 pmBasically the same, just reversed. Quyxkh's solution is more elegant because it's achieving the same result while using less resources (combinators/wires) and operations. On the other hand, every solution that works is valid, and finding one all on one's own is very satisfying. :-D
Indeed. Except that it only works for preventing items from being moved. My setup allows both to load needed items if they're below the fixed threshold, and unload "garbage" in one go.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1725
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: [0.17.x] Filter inserter blacklist and circuit network - How to ?

Post by Pi-C »

Oh, right -- I see now. :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Post Reply

Return to “Gameplay Help”