Fluid and technology built-in parameters

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
alercah
Fast Inserter
Fast Inserter
Posts: 151
Joined: Sun Apr 07, 2019 5:19 am
Contact:

Fluid and technology built-in parameters

Post by alercah »

According to jarg, the regex for matching built-in parameters that reference other localisation strings is "__((ALT_)?CONTROL(_MOVE)?|ENTITY|ITEM|TILE)__.+?__". This is missing, at the very least, fluids and technologies. These should be added in.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Fluid and technology built-in parameters

Post by Rseding91 »

I believe the reason these don't exist is every added one makes every translated string shown in the game slower since it has to check if any of the possible replacements exist in the string.
If you want to get ahold of me I'm almost always on Discord.

alercah
Fast Inserter
Fast Inserter
Posts: 151
Joined: Sun Apr 07, 2019 5:19 am
Contact:

Re: Fluid and technology built-in parameters

Post by alercah »

Is that not done only once when loading the locale files? In any case an optimized regex implementation should be very fast... but a good many are not optimized.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Fluid and technology built-in parameters

Post by Rseding91 »

alercah wrote:
Thu Jul 23, 2020 5:05 pm
Is that not done only once when loading the locale files? In any case an optimized regex implementation should be very fast... but a good many are not optimized.
No, they're done live every time a locale is translated to be shown; since locale can change depending on the scenario being played.
If you want to get ahold of me I'm almost always on Discord.

alercah
Fast Inserter
Fast Inserter
Posts: 151
Joined: Sun Apr 07, 2019 5:19 am
Contact:

Re: Fluid and technology built-in parameters

Post by alercah »

My suggestion then would be to parse the strings only once, the first time on each game that you translate a string (or alternatively do one big pass before starting the game). Convert it into a structured representation that stores the offsets to replace with what, then refer to that when inserting dynamic parameters (parameters that don't change like these ones can probably be substituted in only once when it's loaded and not even made dynamic).

Bilka
Factorio Staff
Factorio Staff
Posts: 3129
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Fluid and technology built-in parameters

Post by Bilka »

Fluid was added to the built in parameters in 1.1.70. Note that since the first post in the thread, several new built-in parameters have been added. They are documented on the wiki: https://wiki.factorio.com/Tutorial:Loca ... parameters
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Post Reply

Return to “Modding interface requests”