Wildcard Interrupts clarification

Anything related to the content on our wiki (https://wiki.factorio.com/)

Moderator: Bilka

Cooltank10
Manual Inserter
Manual Inserter
Posts: 4
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: 1282
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
Manual Inserter
Manual Inserter
Posts: 4
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: 1282
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
Manual Inserter
Manual Inserter
Posts: 4
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.
Post Reply

Return to “Wiki Talk”