[SOLVED] Mofidying the default GUI text for UMC

Discussion of Lua and LuaWML support, development, and ideas.

Moderator: Forum Moderators

Post Reply
User avatar
Inkerrio
Posts: 38
Joined: September 1st, 2021, 8:09 pm

[SOLVED] Mofidying the default GUI text for UMC

Post by Inkerrio »

Is it possible to replace this text with a custom one?

Image

Apparently, there's no LUA or WML, or txt that you could edit to replace GUI text. Turns out, this particular piece of text is contained in report.cpp. As I understand, it isn't possible to edit compiled C++ files, or download fhem from GIT and compile without modifying the core game files.

Maybe there's some other way, like, to repalce this GUI element with a custom made LUA GUI?
Last edited by Inkerrio on December 8th, 2022, 12:34 pm, edited 3 times in total.
User avatar
Ravana
Forum Moderator
Posts: 2997
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Mofidying the default GUI text for UMC

Post by Ravana »

I would try with wesnoth.theme_items Lua.
User avatar
Inkerrio
Posts: 38
Joined: September 1st, 2021, 8:09 pm

Re: Mofidying the default GUI text for UMC

Post by Inkerrio »

Ravana wrote: December 3rd, 2022, 9:15 pm I would try with wesnoth.theme_items Lua.
This actually worked, thank you

Edit: in case someone some day will want to change a tooltip in the default GUI and will be searching for a solution, here's the code

Code: Select all

local gold_bar = wesnoth.interface.game_display.gold
function wesnoth.interface.game_display.gold()
local _ = wesnoth.textdomain "WWII"
local g = gold_bar()
-- remove the old table --
table.remove(g, 1, 2)
-- store side 1 into variable --
side = wesnoth.sides[1]
-- store the gold into variable --
side_gold = side.gold
-- insert the gold variable --
table.insert(g, wml.tag.element {
            text =  side_gold,
            tooltip =  "Supply\n\nThe amount of resources currently available to recruit and maintain your army."
        })

return g
end
I wasn't able to find a way to directly edit the tooltip, it's either not possible or way beyond my LUA knowledge. But you can remove the old tooltip, store a gold variable, make a header + tooltip out of it and insert it in place of the old tooltip

Image
Last edited by Pentarctagon on December 24th, 2022, 9:01 am, edited 1 time in total.
Reason: [code]
User avatar
Celtic_Minstrel
Developer
Posts: 2195
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: [SOLVED] Mofidying the default GUI text for UMC

Post by Celtic_Minstrel »

Please use [code] tags when posting code on the forums, and be sure to make sure it's indented properly as well.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
Toranks
Translator
Posts: 168
Joined: October 21st, 2022, 8:59 pm
Location: Sevilla
Contact:

Re: [SOLVED] Mofidying the default GUI text for UMC

Post by Toranks »

How you have changed the icons?
Post Reply