Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

Recommended Posts

TheTioSweet    0

Hello, is there any way to modify the interface's text limit (recipes, menu)? I'm making a Spanish language pack mod and the English's texts are shorter than the ones in the translation, therefore they cut. Changing the HUD size in General Settings doesn't help at all. My temporary solution is to sum up the texts or shorten words. What can I do? Can I change the font size or something to make the text smaller? Do I have to modify a .lua file? (I don't know any programming BTW).

EEAX.png

ee.png

FFEA.png

aeergbg.png

GGEEAAC.png

Share this post


Link to post
Share on other sites
TheTioSweet    0

Okay, so I checked a Russian Language Pack's modmain.lua and found a piece of code that seem to change strings sizes.

What does this do?

Quote

AddClassPostConstruct("widgets/recipepopup", function(self) --Уменьшаем шрифт описания рецепта в попапе рецептов
    if self.name and self.Refresh then --Перехватываем вывод названия, проверяем, вмещается ли оно, и если нужно, меняем его размер
        if not self.OldRefresh then
            self.OldRefresh=self.Refresh
            function self.Refresh(self,...)
                self:OldRefresh(...)
                if not self.name then return end
                local Text = require "widgets/text"
            local tmp = self.contents:AddChild(Text(GLOBAL.UIFONT, 36))
                  tmp:SetPosition(320, 142, 0)
                  tmp:SetHAlign(GLOBAL.ANCHOR_MIDDLE)
                  tmp:Hide()
                tmp:SetString(self.name:GetString())
                local desiredw = self.name:GetRegionSize()
                local w = tmp:GetRegionSize()
                tmp:Kill()
                if w>desiredw then
                    self.name:SetSize(36*desiredw/w)
                else
                    self.name:SetSize(42)
                end
            end
        end
    end 
    if self.desc then
        self.desc:SetSize(28)
        self.desc:SetRegionSize(64*3+30,130)
    end
end)

When I put in in my modmain.lua and I check the crafting tab, the game crashes. Am I missing something here? I was checking this Russian language pack mod's modmain.lua: https://steamcommunity.com/sharedfiles/filedetails/?id=1562475986&searchtext=. There are Russian comments which I can't read (because I don't know Russian and Google's Translator doesn't help) and I don't understand what is making the game crash.

modmain.lua

There's other piece of code as well that seems to change something about the morgue font size or something. When I use this code, the morgue screen doesn't crash, but I can't go back even though I click "OK". Again, am I missing something here?

Quote

AddClassPostConstruct("screens/morguescreen", function(self)
    if self.obits_titles then
        for str in pairs(self.obits_titles:GetChildren()) do
            if type(str)=="table" and str.name and str.name=="Text" then
                str:SetSize(28)
            end
        end
    end
    if self.RefreshControls then
        local oldRefreshControls = self.RefreshControls
        function self.RefreshControls() -- С помощью грязного хака склоняем слова в причине смерти для двух случаев
            local Text = require "widgets/text"
            local oldTextSetString = Text.SetString
            function Text.SetString(slf, str, ...)
                if str == STRINGS.NAMES.DROWNING or str == STRINGS.NAMES.BURNT then
                    local group = slf:GetParent()
                    local children = group and group:GetChildren()
                    if children then
                        for child in pairs(children) do
                            if child.name == "DECEASED" then
                                local character = child.portrait.texture
                                character = character and character:sub(1,-5)
                                str = t.ParseTranslationTags(str, character)
                                break
                            end
                        end
                    end
                end
                oldTextSetString(slf, str, ...)
            end
            oldRefreshControls(self)
            Text.SetString = oldTextSetString
        end
        self:RefreshControls()
    end
end)

 

Share this post


Link to post
Share on other sites