Wildcard Interrupts clarification

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Cooltank10
Burner Inserter
Burner Inserter
Posts: 10
Joined: Mon Jul 17, 2023 8:15 pm
Contact:

Wildcard Interrupts clarification

Post by Cooltank10 »

Hi, I was just researching on the wiki about wildcard interrupts to get more familiar with them. I noticed that the wildcard icons can be used inside of train stop names but it's fairly vague about explaining that. Here's the paragraph with the issue,
Wildcards will also replace themselves with any rich text icons within the names of train stops. Instead of selecting a target stop from the list, instead click on the "icon" button next to the green confirm button and select the same type of wildcard as used in the condition. Then, type the name of the station. If the stop has a matching icon in its name, then the train will match the item it contains with that icon, and select that stop as the destination.
The underlined section can be interpreted multiple ways; Does the wildcard need to be the first character in the train stop name, or can it be anywhere in the name? Can the wildcard substitute multiple Rich Text icons? Does the wildcard in the train stop name get replaced with what the interrupt condition detects first, or does the other wildcard(s) in the condition/target get replace by the train stop name inside of the condition? What does "matching icon" refer to, like a Rich Text icon or the wildcard icon?
"...the train will match the item it contains with that icon..."
What does it and that icon refer to? Thanks for any assistance, this is one of my first forum posts so if there is any place this needs to go other than here, let me know.
Tertius
Smart Inserter
Smart Inserter
Posts: 1290
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Wildcard Interrupts clarification

Post by Tertius »

Cooltank10 wrote: Fri Jun 06, 2025 12:16 pm Does the wildcard need to be the first character in the train stop name, or can it be anywhere in the name? Can the wildcard substitute multiple Rich Text icons? Does the wildcard in the train stop name get replaced with what the interrupt condition detects first, or does the other wildcard(s) in the condition/target get replace by the train stop name inside of the condition? What does "matching icon" refer to, like a Rich Text icon or the wildcard icon?
- The wildcard can be anywhere in the train stop name. It doesn't need to be at the beginning. The wiki isn't exact.
- One wildcard icon will always be replaced by exactly one rich text icon. Any additional text is unaffected.
- The rich text icon is used that matched when the interrupt condition was true. It doesn't have to be mentioned in the interrupt condition, not even in any waiting condition.
- If you have the green cargo wildcard, and you have different cargo items loaded, so the wildcard could match more than just 1, the game consults the internal item precedence. If you open the item picker and look through the tabs, items more to the left and more to the top have higher precedence. Items on different tabs have precedence if they are in a tab more to the left. That means the wooden chest has the highest precedence (top left on the first tab) and the railgun turret has the lowest (bottom right on the last tab).
For example if your train has both iron ore and stone, the cargo wildcard will be replaced by the stone icon, because the stone icon has precedence over the iron ore icon.

May be it's easier to understand if you think differently. While processing the interrupts, whenever the game engine encounters a wildcard icon, it looks into the train and tries to find the first item of the corresponding type.
- If it encounters a cargo wildcard, it looks into the train cargo and replaces it with the first cargo it finds (see precedence)
- If it encounters a fluid wildcard, it looks into the train fluid wagons and replaces it with the first fluid it finds (see precedence).
- If it encounters a circuit wildcard, it looks at the signals it gets sent by the station and replaces it with the first signal it finds on the circuit network (see precedence).
- Finally, if it encounters a fuel wildcard, it looks up what is in the locomotive fuel inventory and replaces it with the first fuel it finds.
"...the train will match the item it contains with that icon..."
What does it and that icon refer to? Thanks for any assistance, this is one of my first forum posts so if there is any place this needs to go other than here, let me know.
You need to see this as a whole. Making a train go to a station by using interrupts is internally a 2 step process. It takes place when the train is at some station and is about to leave because all of its waiting conditions just became true.
Now, the train wants to leave, the interrupts are consulted. If some interrupt matches, the interrupt constructs a temporary schedule entry. You can see this entry if you look into the schedule. This construction includes wildcard expansion. The temporary schedule will be created with any wildcard replaced. It will only contain real rich text icons, the ones that matched. In case you still see a wildcard in some temporary schedule, you made an error defining the interrupt.

Then, after all interrupts have been processed, the train consults the schedule to actually determine its next destination. The schedule may or may not contain a temporary schedule entry from an interrupt. It just consults the schedule and selects the next entry that's due to be visited. If the temporary entry from the interrupt is the next entry, the train will use this. Since the wildcards are already expanded in this moment, you can exactly see to which station the train wants to go.
Cooltank10
Burner Inserter
Burner Inserter
Posts: 10
Joined: Mon Jul 17, 2023 8:15 pm
Contact:

Re: Wildcard Interrupts clarification

Post by Cooltank10 »

Ok thanks! Few more questions... So if I have a train station that has a iron ore rich text icon as well as a coal rich text icon as its name, a cargo wildcard in the name of a "in ___ station" interrupt would be replaced by the iron ore and never be replaced by the coal? Does the cargo wildcard always copy the first rich text icon it comes across in a station name? What happens when I have 2 cargo wildcards in the scenario above, is one iron ore and the other coal or are they both iron ore? Also thanks for the quick reply. :)
Tertius
Smart Inserter
Smart Inserter
Posts: 1290
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Wildcard Interrupts clarification

Post by Tertius »

Within a given station name, multiple cargo wildcards will be always replaced by the same rich text icon. If you have a name template with 2 wildcards and 2 different ore in the train (iron ore and coal), both wildcards will be replaced by the coal icon. Not one with the coal icon and the other with the iron ore icon. And it's the coal icon and not the iron icon, because the coal icon has the higher precedence.

You can actually have multiple wildcards have replaced with different icons. This works if you use different wildcard types. If you use one cargo wildcard and one circuit wildcard, the cargo wildcard might be expanded to the coal icon if the train carries coal and no additional cargo whose icon has higher precedence than coal, while the circuit wildcard might be expanded to iron icon as long as the circuit network doesn't supply any additional signal whose icon has higher precedence than iron.
Cooltank10
Burner Inserter
Burner Inserter
Posts: 10
Joined: Mon Jul 17, 2023 8:15 pm
Contact:

Re: Wildcard Interrupts clarification

Post by Cooltank10 »

Ok cool, answers all my questions. Thanks for the help :D Now i can finally build a (nearly perfectly) optimized 2-gauge rail system after 800 hours.
Cooltank10
Burner Inserter
Burner Inserter
Posts: 10
Joined: Mon Jul 17, 2023 8:15 pm
Contact:

Re: Wildcard Interrupts clarification

Post by Cooltank10 »

I seem to be stuck on creating a interrupt with 3 different wildcards for a refuel drop-off station.

Context: Currently I'm making a universal refueling/restocking station that should fill a 4-length train (including locomotive) with a fuel (into a cargo wagon and the locomotive itself), item ammo (firearm magazines/artillery shells), and fluid ammo (crude/light oil). It's very complicated right now as I'm using dynamic train limits on the unloading stations, dynamic priority on the unloading stations, giving the train the circuit network conditions of the station to successfully utilize the Circuit Wildcard for the interrupts, AND disabling stations that are empty/full. The stations have names of ONLY rich text icons. They are 4 characters long and the first 3 are (in order): fuel item, item ammo, fluid ammo (which are the corresponding wildcards). The last character is used for determining which stations is a pick-up or a drop-off and is NOT a wildcard. I want the refueling trains to be able to continue to go to drop-off stations until they run out of <fuel> OR <item ammo> OR <fluid ammo>. The point of having wildcards is to be able to change any of the cargo at any time to have increased efficiency from newly-researched better fuels/ammo. The drop-off interrupt needs to have a waiting condition for every type of cargo (which can be replaced by 3 wildcards) so it can leave the station to restock as soon as it runs out of any type of cargo. This requires the interrupt to have 3 different wildcards; a cargo wildcard for <fuel> (in cargo wagons and NOT the locomotive), a signal wildcard for <item ammo>, and a fluid wildcard for <fluid ammo>. I cannot seem to find a way to keep the cargo wildcard from always picking the <fuel> and NOT the <item ammo>, due to the precedence you mentioned above. I can provide a image of the whole setup if it's more useful.

TLDR: I have a cargo wildcard that always chooses the fuel cargo over the other item I want the cargo wildcard to be replaced by (due to precedence). Is there a workaround or solution? :geek:
Tertius
Smart Inserter
Smart Inserter
Posts: 1290
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Wildcard Interrupts clarification

Post by Tertius »

If you load a fuel item into a cargo wagon, it's cargo. Not fuel. The fuel wildcard only deals with what is in the 3 slots of the locomotive fuel inventory.
What you're trying to do isn't feasible. Multiple items per train cannot really be implemented by addressing stations with one of the cargo items/wildcards. For a train carrying multiple items, use fixed station names like "supply loading" and "supply unloading".

The wildcards were implemented for universal trains carrying one type of item. Like ore mines or factories that create green circuits. Every loading station has the same name, and every unloading station has the item in its name that is expected at this station. In this system, an empty train has no identity. It's just an empty train with one default schedule entry: "loading". It will then go to whatever loading station is currently open and most near. It loads some item. When the train is full, an interrupt triggers and the item is identified by a cargo wildcard and assigns a destination station with that item in the name. For example the interrupt detects iron ore was loaded into the train, so the iron ore unloading station is assigned as destination. And the train will proceed to its unloading station.
If the train is empty, it has again no identity. It goes to the next loading station. This time perhaps it is loaded with green circuits. The interrupt triggers and it assigns the green circuit unloading station, so the train will go there. That's the idea behind wildcards and interrupts.

Also see:
https://factorio.com/blog/post/fff-395
https://factorio.com/blog/post/fff-389
Cooltank10
Burner Inserter
Burner Inserter
Posts: 10
Joined: Mon Jul 17, 2023 8:15 pm
Contact:

Re: Wildcard Interrupts clarification

Post by Cooltank10 »

Ok, I can create every permutation of the supply stops as individual interrupts and manually apply them to trains where the items match. The whole point of having the 3 wildcards is to avoid the creation of a LOT of potential interrupts that I would then also have to manually apply to trains.

It's so close, its just lacking functionality for if a train has multiple same-type items in one departure. That would be a very cool addition, preferably if the wildcards can be lists themselves for a (nearly) unlimited amount of items. Actually, is there a mod that exists that adds this functionality that you know of?

Completely forgot mods exist lol. Isn't computer science great? ;)

Edit: I seem to have stumbled into a roadblock with a different problem. After creating the permutations for the unloading interrupts, I finally was able to test out the interrupts and see if they would work as intended. The train has an interrupt that triggers (successfully) with 3 wildcards when at the pickup station to go to a drop-off station. In the Target Station section I have a station with the same 3 wildcards (in order: fuel, signal, and fluid) and it doesn't replace the fluid or fuel wildcards but it replaces the signal one just fine. Even though the train is fully filled with cargo, fluid and fuel from the pickup station. Does the wildcards work in the Target Station section for train stop names? Or just in the Condition section for train stop names? I looked on the wiki and it mentioned wildcard use in train stop names:
Wildcards will also replace themselves with any rich text icons within the names of train stops. Instead of selecting a target stop from the list, instead click on the "icon" button next to the green confirm button and select the same type of wildcard as used in the condition. Then, type the name of the station. If the stop has a matching icon in its name, then the train will match the item it contains with that icon, and select that stop as the destination.
From that information I would have assumed they work in both the condition and target station sections.

Edit2: ((Test 2)) After even further testing, the cargo wildcard seems to work just fine. Does the wildcards only check the first cargo/fluid wagon from the front of the train? Did I just find a bug... LOL

Edit3: ((Test 3)) This is getting long... now I created a entirely new train and interrupt used nowhere else and ALL of the wildcards seem to work fine on that train. The only difference between test 2 and test 3 is that test 2 has more interrupts and dynamic priority + enabling/disabling via circuit network. Now I'm 99% sure this is a bug, as it makes absolutely no sense lol. Typical edge-case bugs :roll:
Tertius
Smart Inserter
Smart Inserter
Posts: 1290
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Wildcard Interrupts clarification

Post by Tertius »

I don't fully understand what you're trying to do. I guess you're trying to use wildcards for what they were not intended. My recommendation again: don't use wildcards for trains with a mix of different cargo items.
Cooltank10
Burner Inserter
Burner Inserter
Posts: 10
Joined: Mon Jul 17, 2023 8:15 pm
Contact:

Re: Wildcard Interrupts clarification

Post by Cooltank10 »

I've made a bug report here that goes into more detail w/ pictures and the like: 129372

The whole reason I'm using wildcards is so I don't have to manually make 60 slightly different interrupts (5 fuel types * 4 item ammo types * 3 fluid ammo types) for a general refueling train. This only gets exponentially worse with mods that add new fuels/new ammos. Although I'm NOT running any mods currently, I would still like it to work in most modded playthroughs. The refueling train has ammo onboard because it makes sense to have one type of train to do ALL types of refilling (refueling trains/refilling defenses) at once instead of 3 dedicated stations for each type. Especially because a dedicated 4-long train would be too much fuel/ammo to haul around feasibly. Correct me if I'm wrong though, as I can definitely change that part.

I highly recommend looking at my world in the bug report to get a better sense of what I'm trying to do. Thanks for the help! :)
Tertius
Smart Inserter
Smart Inserter
Posts: 1290
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Wildcard Interrupts clarification

Post by Tertius »

I apologize, but I question your whole train schedule/station naming approach in that thread. It may be good to investigate the behavior of interrupts and wildcards in a controlled lab environment, but it isn't feasible for a real map.
  • you don't need to carry train fuel around. No outpost needs a supply of train fuel. Just one of the stations the train is guaranteed to visit. That's usually at the base, so you supply these stations with fuel by conventional means, i. e. with belts or bots. And the fuel wildcard can be used for this: one refuel station for each fuel type, if you want that. As soon as the train detects a low fuel situation with an interrupt, it gets a dedicated refuel station assigned by this interrupt, and it will drive there for refuel. Every train with the same amount of locomotives, no matter its layout, can use this station. So the only station in your whole map that needs a supply of train fuel is this one refuel station. A possible switch from one fuel to the next fuel tier can be handled by this station.
  • mix of bulk items like ore and coal in one train: don't do this. Just dedicate one train for one material. Everything is so much easier with that. You have enough space to build multiple unloading stations next to each other, each dedicated for one material. You need multiple stations anyway for throughput reasons.
  • about outpost supply (a): You supply ammo to your outposts while you don't need to do that (use laser turrets). You supply light oil as flamethrower fuel while you don't need to do that (it's a fluid, build a long fluid pipe instead and simply connect the pipe with the nearest crude oil well. One single crude oil well is enough to supply the whole 10000 tile perimeter defense of a megabase. To circumvent the 320 tile limit for a fluid segment, add pumps powered by a solar panel+accumulator in case no power pole is nearby).
  • about outpost supply (b): You didn't supply all the things you will definitely need: repair packs and replacement material such as walls, turrets, inserters, belts, robots to keep your outposts healthy. And if you extend your outpost by putting down blueprints+ghosts that will be built by construction robots. You will add local roboport coverage to all remote locations, so construction robots are able to repair after a biter attack. Building such a supply train and its stations to fill/unload the train is a challenge. Don't get bogged down with station naming, that's not where the challenge is.
ps. example of a refuel station interrupt:
06-13-2025, 10-42-39.png
06-13-2025, 10-42-39.png (78.13 KiB) Viewed 355 times
I don't need the fuel wildcard. The one refuel station will handle everything. It's the "final" variant of that interrupt after I upgraded to nuclear fuel. It's to recall all trains with any previous fuel (these are all the wood/coal/... conditions in the trigger). The refuel station is supposed to remove that fuel with a filtered inserter. After that, only the (nuclear fuel) <= 1 will trigger. The interrupt will assign the "(locomotive)(locomotive) Refuel" station, where the train will be loaded with nuclear fuel (and getting any older fuel removed). It will leave if all locomotives are either full or still have fuel but didn't get full after 30 seconds due to some fuel shortage in production. In this case, the train can run another loop before refuel becomes mandatory.

Additionally, this interrupt will not trigger if the train is currently at some mining outpost - it's supposed to trigger only if it is somewhere near. This is an optional small optimization to streamline train flow.
Cooltank10
Burner Inserter
Burner Inserter
Posts: 10
Joined: Mon Jul 17, 2023 8:15 pm
Contact:

Re: Wildcard Interrupts clarification

Post by Cooltank10 »

you don't need to carry train fuel around. No outpost needs a supply of train fuel.
I should have stated that this was intended to be used in any direction infinitely (until the max rail throughput is reached, which also dictates the maximum size of any given rail system). Would a train still route to a station that is too far away for 3 nuclear fuels to fuel a train to reach the destination?
mix of bulk items like ore and coal in one train: don't do this. Just dedicate one train for one material. Everything is so much easier with that. You have enough space to build multiple unloading stations next to each other, each dedicated for one material.
Now that I reevaluate, I can definitely do this instead of 3 materials per train. This also bypasses the other problem:
You didn't supply all the things you will definitely need: repair packs...
I totally didn't realize that I would need replacement parts for the defenses lol.
You supply ammo to your outposts while you don't need to do that (use laser turrets). You supply light oil as flamethrower fuel while you don't need to do that (it's a fluid, build a long fluid pipe instead and simply connect the pipe with the nearest crude oil well. One single crude oil well is enough to supply the whole 10000 tile perimeter defense of a megabase.
As for the underlined section, I would like the train system to accomodate gun turrets (and artillery turrets if I use them instead of artillery wagons for some reason) for the earlier game when laser turrets are not unlocked yet/inefficient. Later in the game I can totally remove the gun turrets (and hence remove the stations for ammo) for just lasers and/or flamers.
Since this is based on an infinite-ranged scale, making a custom built pipeline from a crude oil patch to the defenses would:
  • not be blueprintable since the nature of random terrain generation.
  • be, at some point, unable to supply a large section of defense that doesn't have a nearby crude oil reserve. Also due to the randomness of the terrain generation. If the defenses doesn't have a nearby crude oil patch, the first issue gets worse.
And yes, I know blueprinting a crude oil patch is impossible but that's ok as that's obviously not supposed to be blueprintable. But less manual labor I have todo means the more base I can place blueprints for. So with a fluid station importing the fluid from the rail network, I can skip the placement of the custom-made pipeline. Hence saving manual labor on placing more items at once (with a station blueprint) than placing every pipe in the custom-made pipeline.

I guess I'm attempting to make a Giga-base style BP book. Is there a common definition of the size of a megabase and gigabase?
Tertius
Smart Inserter
Smart Inserter
Posts: 1290
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Wildcard Interrupts clarification

Post by Tertius »

Cooltank10 wrote: Fri Jun 13, 2025 4:18 pm Would a train still route to a station that is too far away for 3 nuclear fuels to fuel a train to reach the destination?
I doubt you will build a large enough rail network where a train isn't able to get from the center to the outpost and back without refuel in between. Except perhaps you spend weeks to expand just in one direction.
The speed of a locomotive with nuclear fuel is 298.1 km/h (83 m/s).
Nuclear fuel in a running locomotive lasts for 2067.67 seconds.
One meter (m) is one tile in Factorio.
So one nuclear fuel in a train running max. speed lasts for 2067.67 seconds * 83 meter / second = 171561 m = 171561 tiles. You start with at least 3 nuclear fuel, so you use 1 fuel for driving there, 1 fuel for driving back and still have 1 remaining.
2067.67 seconds are 34 minutes 27 seconds continuous driving. I really doubt you will build a base that big. May be if you especially design it to be a narrow but long railworld, but not a regular base. My biggest base (a 10k spm base in 1.1) was about 15000 tiles on the outer perimeter defense. That's less than 10% of that.
Cooltank10 wrote: Fri Jun 13, 2025 4:18 pm As for the underlined section, I would like the train system to accomodate gun turrets (and artillery turrets if I use them instead of artillery wagons for some reason) for the earlier game when laser turrets are not unlocked yet/inefficient.
Laser turrets are never inefficient. Not if you invest into the first few damage researches. I used gun turrets with manual feeding while I didn't have a fixed perimeter defense because of the rapid base expansion. I replaced them with a streamlined and blueprinted perimeter defense that contained both flamethrower turrets (big damage) as well as lasers (finish off remaining enemies). Included roboport ghosts for maintenance when research was finished. I also add artillery much later, but actually the wall as it is is strong enough to keep off every enemy. For me, artillery is mainly a tool to clean an area before I wall it in for my base. After that it just keeps the biters outside the pollution cloud, so there are not many attacks. Artillery shells are supplied by a supply train of course, it's the only ammo I deliver by train.


You talk about "infinite-ranged scale" - are you really planning a base with "infinite scale"? Or it's just a theoretical concept that you design your blueprints to include the infinite case but not actually plan to go infinite? If you really intend to build an infinite factory, the bad news is you cannot. Or better, your PC cannot. You will see the UPS going down the bigger you build, and at some low UPS you will simply stop running that map. My personal lower limit for a megaase I built was 30 ups when I abandoned that map (this was the ~15000 tile thing I mentioned). Lower than 30 ups was a torture for me.
That's far before a base being "infinite". So it's not practical to plan for the infinite case. You will always patch things manually because of the terrain. You're an engineer after all, to make things happen, not an academic.

I see from your save you're playing the base game, without Space Age. If you get Space Age, any "infinite" or "giga base" is completely different to what you can accomplish with the base game. With Space Age, you will not grow to cover whole continents. Instead, you get higher tier machines and boosts to multiply the speed and efficiency of your machines, so you're able to get 100 times the production on a footprint smaller than any non-space age base.

There is some upper limit in the amount of machines the engine (or better: your computer) is able to handle. Space Age counters this by boosting the existing machines.
Cooltank10
Burner Inserter
Burner Inserter
Posts: 10
Joined: Mon Jul 17, 2023 8:15 pm
Contact:

Re: Wildcard Interrupts clarification

Post by Cooltank10 »

Ok thanks for the info, I think I have to moderately redesign my BP's (and interrupts) now that I know those things. Can't wait to launch my first of many rockets after 900 hours! (I might be an academic... :geek: )
Post Reply

Return to “Gameplay Help”