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: 6
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: 1285
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: 6
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: 1285
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: 6
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: 6
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: 1285
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: 6
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:
Post Reply

Return to “Gameplay Help”