[BNW] Custom TopPanel ?

Ohura196

Chieftain
Joined
Apr 17, 2020
Messages
16
Location
Japan
Namely, "X gold earned by trait"
What if I want to display this in the top panel?
 
You'll need to be more specific, where exactly in the top panel?
 
You'll need to be more specific, where exactly in the top panel?
For example, JFD's The Confederation of Switzerland receives 10% gold income of other civilizations, which is written in the section of this image.

ss.png
 
I don't know the answer off the top of my head to this, so this is how I found the file
1) Using a good quality search tool (I use Agent Ransack), search all the game xml files for "available to spend" - this gives one file CIV5GameTextInfos_WorldView.xml
2) Open this file, search for the text and find the associated TXT_KEY (it's TXT_KEY_TP_AVAILABLE_GOLD)
3) Now search all the lua files for this TXT_KEY, it's in TopPanel.lua
4) I have 5 of these, so I open the one from Expansion2 and search for the key, in my copy it's on line 543 and lines 547 to 561 is the code that generates the green text, so you'll need to make a mod that replaces TopPanel.lua with one of your own and add your required changes.

It should be noted that changing TopPanel.lua is not recommended if you're going to redistribute your mod as it will conflict with things like EUI and VP. It would be better to replace just the GoldTipHandler, but you'll need to understand UI tooltip processing to implement that.
 
I'm unsure how up-to-date it is (and even if people even use it anymore), but JFD made a top-panel replacement for modders: https://forums.civfanatics.com/threads/dynamic-top-panel.548485/#post-13849057

I believe, however, that Suktritact's MCIS is more popular for commonly used "mod-support" since (IIRC) it doesn't replace any of the core game files: https://forums.civfanatics.com/threads/sukritacts-modular-city-info-stack.539332/
It's also a bit more dynamic since it allows for fancy stuff like triggering popups.
 
I don't know the answer off the top of my head to this, so this is how I found the file
1) Using a good quality search tool (I use Agent Ransack), search all the game xml files for "available to spend" - this gives one file CIV5GameTextInfos_WorldView.xml
2) Open this file, search for the text and find the associated TXT_KEY (it's TXT_KEY_TP_AVAILABLE_GOLD)
3) Now search all the lua files for this TXT_KEY, it's in TopPanel.lua
4) I have 5 of these, so I open the one from Expansion2 and search for the key, in my copy it's on line 543 and lines 547 to 561 is the code that generates the green text, so you'll need to make a mod that replaces TopPanel.lua with one of your own and add your required changes.

It should be noted that changing TopPanel.lua is not recommended if you're going to redistribute your mod as it will conflict with things like EUI and VP. It would be better to replace just the GoldTipHandler, but you'll need to understand UI tooltip processing to implement that.

GoldTipHandler seems to be getting to the heart of the matter. To change it externally, I think you need a code like this...
Code:
ContextPtr:LookUpControl("/InGame/TopPanel/GoldPerTurn"):

I'm unsure how up-to-date it is (and even if people even use it anymore), but JFD made a top-panel replacement for modders: https://forums.civfanatics.com/threads/dynamic-top-panel.548485/#post-13849057

I believe, however, that Suktritact's MCIS is more popular for commonly used "mod-support" since (IIRC) it doesn't replace any of the core game files: https://forums.civfanatics.com/threads/sukritacts-modular-city-info-stack.539332/
It's also a bit more dynamic since it allows for fancy stuff like triggering popups.

When I saw it once, I didn't understand it, but I think it's actually powerful tool.
 
Top Bottom