Easiest Way To Update Text Strings

isau

Deity
Joined
Jan 15, 2007
Messages
3,071
Hey guys, I understand the Gameplay side of modding the database pretty well, but still have no idea how to update text strings efficiently to tell players what has been changed. I know they reside in a different database than the Gameplay and are loaded in based on the language selected, but that's all.

Two questions about this:

- Is it possible to mod text strings with SQL? (this would be ideal for me)
- If not, can you post/provide a simple example of how to replace text strings?

FWIW I am familiar with how strings were replaced in Civ 4, but never did this with Civ V or now with Civ VI.
 
UPDATE LocalizedText SET Text ='District-based project which provides a large amount of [ICON_Gold] Gold and a small amount of [ICON_GreatMerchant] Great Merchant points.' WHERE Tag='LOC_PROJECT_ENHANCE_DISTRICT_COMMERCIAL_HUB_DESCRIPTION';

Works fine.
 
Thanks for that.

Is there a way to load the text string database like there is with the Gameplay database? I suppose I could hunt for tags in the XML. But a database would be better.

Also, can you perform concatenations on the CVI database actions like the one below to grab existing text and tag onto it? For example, would the line below work?


UPDATE LocalizedText SET Text =Text || ' Here is some additional text to tag onto the end of the string.' WHERE Tag='whatever';
 
Addendum, in fact I am not able to mod the LocalizedText database/table from what I can see. I'm getting an error in the Database.log file:

[4059763.658] [Gameplay] ERROR: no such table: LocalizedText

Is there some extra bit of code that needs to exist?

Here's the offending line I wrote:

UPDATE LocalizedText SET Text=Text || ' (Quos Mod: Scout has +1 Vision and starts at level 2)' WHERE Tag='LOC_UNIT_SCOUT_DESCRIPTION' ;


Thanks again for any help.
 
Addendum, in fact I am not able to mod the LocalizedText database/table from what I can see. I'm getting an error in the Database.log file:

[4059763.658] [Gameplay] ERROR: no such table: LocalizedText

Is there some extra bit of code that needs to exist?

Here's the offending line I wrote:

UPDATE LocalizedText SET Text=Text || ' (Quos Mod: Scout has +1 Vision and starts at level 2)' WHERE Tag='LOC_UNIT_SCOUT_DESCRIPTION' ;


Thanks again for any help.
Concatenation should work, but remember that the modinfo file use a different section to update the text database, see LocalizedText here: https://forums.civfanatics.com/threads/civ6-modinfo-schema.606784/
 
Concatenation should work, but remember that the modinfo file use a different section to update the text database, see LocalizedText here: https://forums.civfanatics.com/threads/civ6-modinfo-schema.606784/


Thank Gedemon. Unfortunately I'm still having issues with it, probably because my Modinfo is configured wrong.

Do you know of a functional mod that actually incorporates SQL updates to LocalizedText? I've downloaded lots and haven't been able to find one to mirror the structure of. I also attached my non-working version of my mod to this post to show how I tried to set it up if anyone wants to take a look and point out the error. I coded out the concatenation statements and replaced with straight text updates to test, but they don't seem to work.
 

Attachments

  • Quo's Combined Tweaks BROKEN TEXT.zip
    4 KB · Views: 67
Awesome, got it working. One last question.

Is it possible to mod the text so that it shows up when selecting leaders? I've changed the descriptions of a few leader abilities. But currently, it only shows up after loading the game, not on the screens where you make your selections. Would be very nice if players could see ahead of time what the changes were.

Thanks again!
 
For that you have to mod the Configuration database, the tables Players and PlayerItems too I think, contain civ/leader descriptions during game setup.
You have to load the .sql/.xml file with the Settings tag, see Civ6 .modinfo schema.
Code:
  <!--Objects loaded on game set up-->
  <Settings>
    <!--Updates to Configuration database (DebugConfiguration.sqlite)-->
    <Custom id="Arbitrary_Custom">
      <Items>
        <!--Some peopler are putting <Component> tags here,-->
        <!--But they're not even read into the Mods.sqlite database.-->
        <File>SomeConfigDatabaseUpdate1.xml</File>
        <File>SomeConfigDatabaseUpdate2.sql</File>
      </Items>
    </Custom>

(...)
  <Settings>
 
Thanks Fuyu. I was able to connect to the Configuration database, and I can see where the text labels are (in the Players table, LOC_TRAIT_LEADER_ROOSEVELT_COROLLARY_DESCRIPTION, for example) but I don't see how to update that text, since the Localization part of the mod doesn't perform its update until after the game loads. Is there some way to write to the game's localization tables before the game loads?
 
Update, nevermind, figured it out based on looking at the mod structure Horem used for his mod. Text is now showing correctly, thanks!
 
Top Bottom