How can I use Interrupts to go to Parametrized Pickup Stations?

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
RMDragon
Manual Inserter
Manual Inserter
Posts: 1
Joined: Wed Oct 23, 2024 10:28 pm
Contact:

How can I use Interrupts to go to Parametrized Pickup Stations?

Post by RMDragon »

I am trying to use the new interrupt system to build a rail network where any train can pick up and drop off any type of item. I have set up each station with names of "[Item icon] Pickup" or "[Item icon] Dropoff", where [Item icon] is what is being loaded/unloaded there.

I have managed to set up the interrupt for the generic drop-off stations without issue, but I'm having some problems setting up the one for the pick-up ones.

Originally, I tried using the "Item count" condition setting the [Item Parameter] equal to 0. I was hoping this would match any item that is not in the train cargo, and go to the corresponding station. However, as far as I can tell, this doesn't work because only items that are already in the cargo are being considered.

These are some solutions I found, but all of them have some disadvantages that I would like to avoid:
  1. Re-naming all pickup stations to "Pickup", regardless of what they load. That is, removing [Item icon] from all the pickup station names. Then, having an interrupt condition where if the train is empty it goes to a "Pickup" station. This does work, but it means I can't tell what the station is loading from the name, which I don't like.
  2. Another approach that does seem to work is setting an interrupt condition checking for a circuit [Signal Parameter], and setting the target station to "[Signal Parameter] Pickup". If I then connect a constant combinator to all stations and set the signals to all the possible [Item icon] values, the trains are able to find the corresponding stations. However, this means I would need to change the signals each time I added a new pickup station type. This is easy enough to do with logistic groups, but I am sure I would eventually forget to do it when adding a new type of station.
  3. So far, my preferred solution is doing option 2, but adding signals for all items I may ever want to load into a train. Then, I set the interrupt conditions to [Signal Parameter] > 0 AND "[Signal Parameter] Pickup" is not full. The second condition is important, as otherwise the train can pick any signal it receives, even if no station with that name exists, which breaks the system. Other than the almost negligible cost of one constant combinator for every new station I create, the main downside of this approach is the amount of time it will take me to add all the potentially relevant signals to the constant combinator. Also, if I ever want to use this system with items added by mods, I would have to remember to add those to the blueprint.
Is there any way to achieve this without having to add the constant combinator with all the signals? Am I missing something in how I can use the interrupts?
Kalanndok
Long Handed Inserter
Long Handed Inserter
Posts: 92
Joined: Sat Dec 12, 2015 9:07 am
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by Kalanndok »

Have three types of stations.

Pickup, [item] dropoff and depot.

Schedule the train to always go to pickup and wait until full.
Interrupt it if [ItemWildcard] > 0 to go to [ItemWildcard] dropoff and wait until empty.
Interrupt it if "[no Destination] and not at depot and not at pickup" to go to depot without wait condition.
(and of course: Interrupt it if low fuel and set it to go to refuel :) )

What this does:
It clears the dropoff incase no pickup is accepting trains.
It makes the train go directly to a pickup if finished unloading.
It has a full train blocking the pickup station where the produced item has no demand anyways so no other trains come in to pickup stuff that's not needed.

What you need to make sure though:
Always have pickup stations request at least one train (if it's waiting at the depot it can also wait at the pickup stations...it's out of the way and even gets loaded slowly).
Always have at least as many trains as you have pickup stations.
Never have more trains than you have pickupstations plus depot plus pickup-station-waiting-space.
Tertius
Smart Inserter
Smart Inserter
Posts: 1407
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by Tertius »

The crucial thing is to name all pickup stations the same, no matter the item. Once loaded with something, the interrupts decide where this will be delivered.
The only fixed station in the schedule is the pickup station. Everything else works through interrups. The delivery stations have all different, item specific names.

To get a picture in your mind, imagine you're a train.
  • You're currently empty and looking for work.
  • In your schedule, you're ordered to go to a station called "pickup".
  • Since there are many stations called "pickup", you're driving to the next one with a free slot.
  • You arrive at the station, and something is loaded into you.
  • The waiting condition becomes true, and you're about to leave the station. But where?
  • You have a book called "interrupts" that tells you where to drive, dependent on what you're carrying, so...
  • you look into what was loaded into your cargo wagons.
  • You try to match the cargo you detected with the entries in the interrupt list by checking the interrupt conditions.
  • You select the first matching interrupt and copy its schedule into your regular schedule as temporary entry.
  • You drive to the next schedule entry.
Keep in mind the interrupt list is checked just when the train is about to leave a station and trying to find a destination. It's not checked if the train is en route or waiting at a red signal.

You can enter one interrupt for every different cargo, or you can use the new green wildcard/substitution parameters for the interrupt condition and schedule.
The green wildcard works on the loaded cargo. It doesn't look at stations, it looks and matches the cargo currently loaded in the train. Once matched, the wildcard in destination station names is replaced with the matched item, constructing a real station name, and the train will have this station as destination.

Example for one interrupt per cargo can be seen in https://factorio.com/blog/post/fff-395 (first image) and an example for the wildcard can be seen in the second image. Generic description for interrupts in https://factorio.com/blog/post/fff-389
User avatar
AileTheAlien
Filter Inserter
Filter Inserter
Posts: 400
Joined: Sat Mar 11, 2017 4:30 pm
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by AileTheAlien »

Tertius wrote: Thu Oct 24, 2024 12:01 pmThe only fixed station in the schedule is the pickup station.
Actually, I don't think it's necessary to have generic 'pickup' stations in your schedule, and you can keep the icons in your pickups. (Or "load", whatever you call them.)
RMDragon wrote: Wed Oct 23, 2024 11:34 pmRe-naming all pickup stations to "Pickup", regardless of what they load. That is, removing [Item icon] from all the pickup station names. Then, having an interrupt condition where if the train is empty it goes to a "Pickup" station. This does work, but it means I can't tell what the station is loading from the name, which I don't like.
I also wanted to keep my pickup stations named with icons, and I think the included proof-of-concept blueprint should fill your needs. (It has five stations, and is a very small loop of track. The arrows point to the wagon if it's loading, and to the resource if it's unloading.) At a "wait for orders" station (or "depot", whatever), the train waits until it receives the circle-i ("info"?) icon signal, before it tries to leave. The item-wildcard interrupt is then immediately fulfilled, because it checks for a generic item signal, which is then filled in by the combinator hooked up to the leftmost chest, and your "load (item)" destination is set. These two screenshots should also help, in case I phrased this poorly. (I'm actually surprised that nobody figured this out, or didn't share it. I guess I had to share it. :P ) Please note, the chests and decider combinators are just stand-ins for real signals shared across your train network by radars. 8-)
map
annotated blueprint
blueprint string
Last edited by AileTheAlien on Tue Nov 12, 2024 12:51 am, edited 1 time in total.
Afroman
Burner Inserter
Burner Inserter
Posts: 17
Joined: Fri Jan 06, 2017 3:28 am
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by Afroman »

Sorry, I think I'm going to need more instructions here:

I'ver played around with the blueprint but can't figure it out.
The topmost combinator is waiuting for <train stop> signal to be >0. How does it get that signal?

I tried changing the signal to iron plates, then adding som iron plates in the corresponding chest, but then.... wait..... Imaybe I got it..... I'll get back to you....
Serenity
Smart Inserter
Smart Inserter
Posts: 1017
Joined: Fri Apr 15, 2016 6:16 am
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by Serenity »

Wube teased completely generic trains in the FFF, but those don't seem to work so well. I tried completely generic loading stations and what happened is that I had multiple trains going to stone and coal mines when I really needed only one. And I needed those other empty trains to get iron and copper. So I now have fixed loading stations, with interrupts for unloading, refueling and depots.

This gives me control over the amount of trains running for each resource. The depot stations could probably be eliminated as long as there are enough stacker spaces at the loading and unloading stations.
Tertius
Smart Inserter
Smart Inserter
Posts: 1407
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by Tertius »

Serenity wrote: Mon Nov 11, 2024 8:33 pm I had multiple trains going to stone and coal mines when I really needed only one.
In this case, it seems you set the train limit of these stations higher than 1, so multiple trains are sent there. If these loading stations are the nearest ones, trains are going there first, before they go to stations more far away. You could employ more trains, so if the nearer stations are all full, the more far away stations are visited.

I have a static limit of 2 in all my loading stations, and I did another thing to avoid first filling all slots of the nearest stations before trains go to the others: I have a circuit that raises station priority to 51 if there are 0 train slots reserved on a station and keep it at 50 if more than 1 slots are reserved. This way all stations regardless the distance are filled with 1 train first before the station gets a second train.
Serenity
Smart Inserter
Smart Inserter
Posts: 1017
Joined: Fri Apr 15, 2016 6:16 am
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by Serenity »

Tertius wrote: Mon Nov 11, 2024 10:37 pm In this case, it seems you set the train limit of these stations higher than 1, so multiple trains are sent there.
It wasn't trains going there at the same time, but another train pathing to the mine after the first one left. Train limits don't help with that.

Maybe one could set the priority of stations depending on the importance of the resources. But while that seems easy enough with stone vs iron/copper ore, this would break down with more complex networks transporting different kinds of intermediate products.
Tertius
Smart Inserter
Smart Inserter
Posts: 1407
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by Tertius »

Serenity wrote: Tue Nov 12, 2024 12:13 am It wasn't trains going there at the same time, but another train pathing to the mine after the first one left. Train limits don't help with that.
Probably you need more trains. Sum up the train limit of all stations, employ as many trains. Additionally, add a depot as buffer for empty trains, so empty trains can leave the unloading station.

If you have dynamic limits, add the maximum limit. The depot need to be big enough to store the additional trains that cannot go anywhere, if the limit is lower than the maximum. For example, if you have 10 stations with a dynamic limit of 0..2, your depot should have (2-0) * 10 = 20 lanes.
I used to build stations with dynamic limits for ore, but I realized static limits and enough trains are better. Loading stations don't even need buffer chests, because there is always a train waiting at the station, if you have enough trains.
jirkov
Burner Inserter
Burner Inserter
Posts: 8
Joined: Thu Nov 07, 2024 4:07 pm
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by jirkov »

Serenity wrote: Mon Nov 11, 2024 8:33 pm Wube teased completely generic trains in the FFF, but those don't seem to work so well.
Upgrading trains to groups and their shared work is an absolutely amazing improvement. I have almost 60 trains handling about 20 different types of materials. So one train can easily have a route that goes for uranium ore, plastics, red circuits, copper ore, copper wires and other various types that are needed at the time. Of course, it will take a bit of work to create the basic logic of train movement, but in the end it looks beautiful when the trains are not standing still, but running efficiently. It helps a lot in the case of an increased need for one material, when the normal static number would not be able to keep up, but the trains are automatically reordered and the given transport is strengthened. Adding new material consists of setting up a unified loading plan, where I specify the material in one comparator, by setting up a unified unloading plan, where again I specify the material in only one comparator and adding a simple condition to the group for interruption. And now the trains can handle new material for transportation.
User avatar
AileTheAlien
Filter Inserter
Filter Inserter
Posts: 400
Joined: Sat Mar 11, 2017 4:30 pm
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by AileTheAlien »

jirkov wrote: Tue Nov 12, 2024 12:58 am Adding new material consists of setting up a unified loading plan, where I specify the material in one comparator, by setting up a unified unloading plan, where again I specify the material in only one comparator and adding a simple condition to the group for interruption. And now the trains can handle new material for transportation.
Can you share a blueprint for one of your trains that's in this group? I'd like to see how their schedule and interrupts are set up. Blueprints for your stations would probably also help. Right now, I've got trains with a generic signal interrupt, but because they can't reserve a drop-off station until they start pathing there, I've got more trains getting scheduled than requester stations can support. (So trains back up, filled with resources they can't unload.)
insaneostyle
Manual Inserter
Manual Inserter
Posts: 1
Joined: Mon Jul 14, 2025 10:59 pm
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by insaneostyle »

Can’t believe nobody has said it considering this is almost a year old, but the solution to keeping the unique names is very simple. Train groups! If you really want your pickup types to all have unique names you just need to make groups for each item you want to transport, an interrupt for dropping off cargo, an interrupt for dropping off fluids, and an interrupt for refueling. Then just set your one station to whatever the pickup name is for that group, conditioned for full cargo, put (wildcard) drop off interrupt, add trains to group, make next group, repeat, profit. Kinda tedious but since you can blueprint trains it’s not so bad.
Mr.Fran
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri Aug 29, 2025 2:13 am
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by Mr.Fran »

That's the same as the old system with trains dedicated to each resource type.

The problem with using a central depot station to assign a pickup station to a general train is the trains have to cycle through the depot station every time they finish their route. They can't go directly from an unload station to a different pickup station when they're empty. With long distances this is pretty inefficient and adds to rail congestion.

The only way I can think of to do unique pickup station names with generic trains is to have a central computer which monitors stock levels at all the pickup and unload stations, and sends signals to trains to assign them to pick up a certain resource when needed. The trains could read the signal at any unload station once they're empty. But the computer would have to know the capacities of each station and prioritize the resources and stations on the fly. So it's far from an easy solution.

The solution I settled on was to name all the pickup stations the same, and use a display panel to show the resource icon on the map. That doesn't help in the train view though since I still can't tell which station it's going to without checking the route.

Overall the interrupts work great, but the generic trains idea feels half-baked to me. It can't be made robust and efficient without a ton of circuit logic.
Tertius
Smart Inserter
Smart Inserter
Posts: 1407
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by Tertius »

Mr.Fran wrote: Fri Aug 29, 2025 2:27 am The problem with using a central depot station to assign a pickup station to a general train is the trains have to cycle through the depot station every time they finish their route. They can't go directly from an unload station to a different pickup station when they're empty.
It's quite easy to build interrupts that shortcut the depot.
Actually that's the way you can include the depot in your setup in the first place.

Static schedule:
go to pickup station; wait until full

Interrupt for delivery:
condition: "Cargo <cargo wildcard> present"
destination <cargo wildcard> unload; wait until empty

Interrupt for depot:
condition: "unknown destination or destination full AND not at depot AND has cargo"
option: allow to interrupt other interrupts
destination: depot; time elapsed 2 seconds


This way a full train at a pickup station will first trigger the interrupt for delivery and get the cargo-specific unloading station as destination. If this destination isn't full, the train will directly drive there.
But if it is full, the train will get into "destination full" mode. Now the interrupt for depot will trigger, since the train isn't at the depot (it's at the pickup station) and it is in the destination full condition. The depot interrupt is being allowed to interrupt other interrupts, so it will replace the current destination with the depot station.

So now the train will drive to the depot.

At the depot it will wait for 2 seconds, then interrupts will trigger again, namely the "interrupt for delivery". The train gets the cargo-specific unloading station assigned again. It will again go into "destination full" mode if all unloading stations are still full, but that's ok, since we are now at the depot and that's what the depot is for. The depot interrupt will not trigger this time, because it is configured to not trigger when at the depot station. Trains will sit at the depot with "destination full" until some destination opens up, so one train will wake up and drive there.

About the interrupt for depot and cargo: It may or may not be desirable to include a cargo condition to the depot interrupt condition, depending on what you want to do with empty trains sitting at unloading station and all pickup stations are currently full. Remember "destination full" can also trigger for the main schedule entry, for the pickup station.
Do you want those empty trains go to the depot as well, or do you want those trains stay at the unloading station? Depending on what you want, you can include or omit the "...AND has cargo" part of the depot interrupt condition. You can also build a second depot empty trains, with a second interrupt, and you add a cargo empty condition instead of has cargo as with the interrupt above.
jdrexler75
Fast Inserter
Fast Inserter
Posts: 142
Joined: Sat Nov 28, 2020 5:27 pm
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by jdrexler75 »

It would be nice if we could just put wildcards in the pickup order station name, and it would go to any matching station, instead of requiring an exact name. I think this is what OP is asking for?
Screenshot_20250829_122815r.png
Screenshot_20250829_122815r.png (18.28 KiB) Viewed 232 times
I wonder if there's a suggestion for this already, didn't see one at a quick glance.
Tertius
Smart Inserter
Smart Inserter
Posts: 1407
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by Tertius »

jdrexler75 wrote: Fri Aug 29, 2025 10:29 am It would be nice if we could just put wildcards in the pickup order station name.
That's not included in the game design.

As far as I followed the threads and ideas that tried to implement this with some kind of circuit setup, all these attempts failed in the long run. It's simply not supported by design by the game engine. You can of course build large circuit contraptions to handle 99% of all the edge cases, but there is no advantage in comparison to just name all pickup stations the same and let the interrupts decide where to bring the loaded material. Or in comparison to just handle each material individually and statically as in Factorio 1.1.
jdrexler75
Fast Inserter
Fast Inserter
Posts: 142
Joined: Sat Nov 28, 2020 5:27 pm
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by jdrexler75 »

Tertius wrote: Fri Aug 29, 2025 11:00 am
jdrexler75 wrote: Fri Aug 29, 2025 10:29 am It would be nice if we could just put wildcards in the pickup order station name.
That's not included in the game design.
...which is why I said it would be nice. It shouldn't be particularly UPS-intensive either to find matching station names, compared to the actual station selection and pathfinding. I imagine the game already has a lookup table of all station names anyway since they change almost never.

Like OP I too miss seeing the cargo type in the generic station name we're now forced to use. It's the remaining piece of the puzzle to round out completely generic trains.
Mr.Fran
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri Aug 29, 2025 2:13 am
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by Mr.Fran »

That's exactly right. As it is now there's no way to have a generic train go to differently named pickup stations (ie. when the train is empty) without a ton of combinator work.

Adding the wildcard station name match as discussed in the other thread (viewtopic.php?t=119162) seems like an easy solution to this. There is already the fuel and train contents symbol match so this isn't really a stretch.
Tertius
Smart Inserter
Smart Inserter
Posts: 1407
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: How can I use Interrupts to go to Parametrized Pickup Stations?

Post by Tertius »

Mr.Fran wrote: Sat Aug 30, 2025 12:14 am As it is now there's no way to have a generic train go to differently named pickup stations (ie. when the train is empty) without a ton of combinator work.
That's not the whole story. It depends on your entire use case. It can be very simple for this use case:
  • You want to have a group of multi item trains. All trains in this group have the same predefined constant set of items. For example 1000 iron ore, 500 green chips, 500 low density structures etc.
  • Each of these items are available from accordingly named loading stations, i. e. "<iron ore> load", "<green chip> load", "<low density structure> load" etc..
  • you want to unload these items at some universal unloading stations ("multi unload") OR you want to unload these items at item specific unloading stations ("<iron ore> unload", "<green chip> unload", "<low density structure> unload")
  • you want the train go to all the loading stations one after the other in case the train doesn't yet has the predefined amount in its wagons.
The part of directing the trains to the proper item specific loading stations to fill and refill the train is accomplished by 1 constant combinator and one interrupt.
First define the set of items the train should carry in a logistic group called "Train load".
Notice the -1 multiplicator for this constant combinator, so the output is actually all negative. Build such a constant combinator next to each loading station and connect it to the station with one wire.
08-31-2025, 13-10-57.png
08-31-2025, 13-10-57.png (37.18 KiB) Viewed 44 times

Station setup:
It reads train content and sends circuit network content to the train. In combination with the signals from the constant combinator, signals with surplus are positive signals for a train waiting condition and signals with demand are negative signals. [You still have the other wire color free with the unmodified train content, so you can use it for additional circuit for controlling inserters for train loading.]
08-31-2025, 13-48-32.png
08-31-2025, 13-48-32.png (257.72 KiB) Viewed 39 times
08-31-2025, 13-13-41.png
08-31-2025, 13-13-41.png (40.35 KiB) Viewed 44 times
So we can build an interrupt for our train group like this:
Wildcard check for negative circuit signal. In case one is found and the corresponding loading station isn't full, it's set as destination.
08-31-2025, 13-16-50.png
08-31-2025, 13-16-50.png (99.27 KiB) Viewed 44 times
That's all for the part of selecting loading stations. Of course this is a setup for fully static train content.

It cannot work for dynamically changing train content, because every station has the same item layout (given by the logistic group in the constant combinator).

Dynamic train content has to support separate item layout for every single train, and that's where every approach I saw failed, because there is no feasible way to temporarily memorize and store train content signals in the circuit network. But this approach isn't efficient anyway, since for satisfaction of some unloading station an empty train is dispatched, then being loaded, and finally being unloaded. As far as I understand, that's the approach for mods like LTN, but that's just not efficient and shouldn't be used because of that. With a predefined set of items, any train is already preloaded with all the predefined items and waiting in a depot, so it takes just half the time to satisfy a request.
Post Reply

Return to “Gameplay Help”