[Solved] Item localized desc with startup setting variable

Place to get help with not working mods / modding interface.
Post Reply
rookhaven
Inserter
Inserter
Posts: 22
Joined: Sun May 07, 2017 9:21 pm
Contact:

[Solved] Item localized desc with startup setting variable

Post by rookhaven »

I'm trying to put a startup setting in as a variable in my item description. This works fine in the control stage, but I'm not getting it to work in the data stage. The settings tutorial page seems to indicate it can be done (as do other posts) but I be dumb. This is literally the first example from the wiki. Does this not work for localization settings at data stage? Settings is the first stage right?

From Wiki:

Code: Select all

--in settings.lua:
data:extend({
    {
        type = "int-setting",
        name = "my-mod-stone-wall-stack-size",
        setting_type = "startup",
        minimum_value = 1,
        default_value = 100
    }
})

--in data.lua:
data.raw.item["stone-wall"].stack_size = settings.startup["my-mod-stone-wall-stack-size"].value
I have the following in my locale.cfg (ellipsis mine):

Code: Select all

[item-description]
k2cp-city=...They can also only be placed within __1__ tiles of each...
The variable to populate the __1__ is a startup setting defined as follows. The setting works fine in the control stage - does what it's supposed to:
My settings.lua:

Code: Select all

data:extend({
 {
	type = "int-setting",
       	name = "k2cp-city-distance",
	setting_type = "startup",
	admin = true,
	default_value = 320,
	minimum_value = 32,
	order = "c"
},
I tried a couple things. In data.lua I have the following. I tried it in data-final-fixes.lua as well, but neither are working. The description just shows up with the __1__ in it. No errors are returned.
My data.lua:

Code: Select all

require("prototypes.entities")
require("prototypes.items")
require("prototypes.recipes")
require("prototypes.style")
require("prototypes.technology")

data.raw.item["k2cp-city"].localized_description = {"item-description.k2cp-city", settings.startup["k2cp-city-distance"].value}
Please advise and thank you.
Last edited by rookhaven on Sat Oct 10, 2020 7:22 am, edited 1 time in total.

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

Re: Item localized desc with startup setting variable

Post by Bilka »

The --check-unused-prototype-data command line option shows:

3.480 Warning PrototypeLoader.cpp:202: Value ROOT.item.k2cp-city.localized_description[0] was not used.
3.480 Warning PrototypeLoader.cpp:202: Value ROOT.item.k2cp-city.localized_description[1] was not used.

It's "localised_description".
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

rookhaven
Inserter
Inserter
Posts: 22
Joined: Sun May 07, 2017 9:21 pm
Contact:

Re: Item localized desc with startup setting variable

Post by rookhaven »

Isn't that what this line is my data.lua is doing (see original code) - setting the localized_description for the item? I did try it in the item definition directly and in data-final-fixes, but it's still coming back with the __1__ showing instead of the setting value. The setting value must be coming back as null? Are my brackets correct?

Code: Select all

data.raw.item["k2cp-city"].localized_description = {"item-description.k2cp-city", settings.startup["k2cp-city-distance"].value}

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2633
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: Item localized desc with startup setting variable

Post by steinio »

S instead of Z in localised
Image

Transport Belt Repair Man

View unread Posts

User avatar
ickputzdirwech
Filter Inserter
Filter Inserter
Posts: 768
Joined: Sun May 07, 2017 10:16 am
Contact:

Re: Item localized desc with startup setting variable

Post by ickputzdirwech »

It’s probably not the first time this is mentioned but you have to be careful how you write certain words (just copy paste them to be sure) since the used dialect isn’t entirely consistent. For example “color” (American) and “localised” (British).
Mods: Shortcuts for 1.1, ick's Sea Block, ick's vanilla tweaks
Tools: Atom language pack
Text quickly seems cold and unfriendly. Be careful how you write and interpret what others have written.
- A reminder for me and all who read what I write

rookhaven
Inserter
Inserter
Posts: 22
Joined: Sun May 07, 2017 9:21 pm
Contact:

Re: Item localized desc with startup setting variable

Post by rookhaven »

Wow, I feel sheepish. The eyes certainly see what they want to see don't they.

Thanks all. Marking resolved.

Post Reply

Return to “Modding help”