[closed] How to change golds description in upper gold counter?

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

Moderator: Forum Moderators

Post Reply
User avatar
ZombieKnight
Posts: 156
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

[closed] How to change golds description in upper gold counter?

Post by ZombieKnight »

Hi,
I've got a silly idea, how to change golds description in counter (now it says "Gold the amount of gold currently avaible to recruit and maintain your army" and I'd like to change it to something funny(idk what exactly)...)
Any ideas how to do so?
Last edited by ZombieKnight on March 31st, 2024, 12:29 pm, edited 1 time in total.
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
Celtic_Minstrel
Developer
Posts: 2235
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: How to change golds description in upper gold counter?

Post by Celtic_Minstrel »

I think you're looking for wesnoth.interface.game_display.gold.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
ZombieKnight
Posts: 156
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: How to change golds description in upper gold counter?

Post by ZombieKnight »

Hi (sorry for delay, I've got many problems)
This code changes the text and tooltip...

Code: Select all

local old_label = wesnoth.interface.game_display.gold
function wesnoth.interface.game_display.gold()
    --local _ = wesnoth.textdomain "mydomain"
    local s = old_label()
    table.insert(s, wml.tag.element {
            tooltip ="Tooltip",
            text = "Text"
        })
    return s
end
wesnoth.interface.game_display.gold()
I call it using this:

Code: Select all

[lua]
             code="wesnoth.dofile '~add-ons/Bandits_from_Brown_Hills/lua/change_labels_tooltip.lua'"
         [/lua]
It works like it should... except the Numbers tooltip doesn't change (only the texts tooltip changes viz. screenshots)
Aaand it disaperares, when saved and re-loaded.

If you know what I'm doing wrong, please tell me.
Any ideas?
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
ZombieKnight
Posts: 156
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: How to change golds description in upper gold counter?

Post by ZombieKnight »

Oh idk how to upload the screenshots...
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
Pentarctagon
Project Manager
Posts: 5566
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: How to change golds description in upper gold counter?

Post by Pentarctagon »

Below the text area, there's an "attachments" tab.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
ZombieKnight
Posts: 156
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: How to change golds description in upper gold counter?

Post by ZombieKnight »

What do yoy mean?
Why does it dissapear, when I load the game?
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
Ravana
Forum Moderator
Posts: 3012
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: How to change golds description in upper gold counter?

Post by Ravana »

You need first_time_only=no for your preload event.
User avatar
ZombieKnight
Posts: 156
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: How to change golds description in upper gold counter?

Post by ZombieKnight »

Ok, thats weird, like it stay, when I set units description to "This".
Ill do so... which attachments index is description stored?
Or is is it stored in variable sonewhere? That should be easy to modify.
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
ZombieKnight
Posts: 156
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: How to change golds description in upper gold counter?

Post by ZombieKnight »

Oh, got it.
Works now...
Thanks!!!
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
ZombieKnight
Posts: 156
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: How to change golds description in upper gold counter?

Post by ZombieKnight »

How to acces the variable, containing number of villages side sees? (to set the village text to default one, while modifying the tooltip)
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
ZombieKnight
Posts: 156
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: How to change golds description in upper gold counter?

Post by ZombieKnight »

Hell, I'm trying to reproduce the INCOME counters normal behavior...
How to define it same as its normally? (so I can modify the code)

Code: Select all

function wesnoth.interface.game_display.income()
	return { { 'element', {
		text = wesnoth.sides[wesnoth.interface.get_viewing_side()].net_income,
		tooltip = wml.variables["income_tooltip"]} } }
end
doesn't work as negative values aren't red, like normally
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
ZombieKnight
Posts: 156
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: How to change golds description in upper gold counter?

Post by ZombieKnight »

Solved
I had saurian in profile before, but I've merged my discord profile with forum one...
Post Reply