hazel16
Chieftain
- Joined
- May 5, 2014
- Messages
- 64
I really appreciated Pazyryk's time-saving SQL tricks here. After automatically generating the 'TXT_KEY' fields in SQL, I wanted to figure out a way to automatically generate the Language_en_US XML files too. The following takes a few steps but will save time if you have 50+ buildings or units to add. It will also reduce the possibility of typing mistakes.
In order to follow these steps, you must have already created your buildings (or units, or civilizations) in XML/SQL and loaded your mod in-game.
1. Open your Civ5DebugDatabase.db (Documents\My Games\Sid Meier's Civilization 5\cache\Civ5DebugDatabase.db) in SQLLiteSpy
2. Paste the following code into the statement box. Replace the blue text with the table you want to create your XML file from and the red text with the prefix you used in your 'Type' column.
3. Go to Execute -> Execute SQL (F9).
2. Go to XML_Merge table and copy contents. Click on a row, press Control-A to select all and then copy.
3. Go to http://titlecapitalization.com/, paste your content in the text box. It will automatically capitalize it. Then copy text back from the box.
4. Paste inside new XML file that's set up like this:
5. Delete the top line of the pasted code ("text_XML")
6. This file would be easier to read if there were more line breaks between rows. Go to find/replace (Control-H). Check the box 'Use Regular Expressions'. Do the following:
7. Your file should be ready to use.
NOTE: If you're doing this more than once, you need to run following SQL code prior to starting.
In order to follow these steps, you must have already created your buildings (or units, or civilizations) in XML/SQL and loaded your mod in-game.
1. Open your Civ5DebugDatabase.db (Documents\My Games\Sid Meier's Civilization 5\cache\Civ5DebugDatabase.db) in SQLLiteSpy
NOTE: you can download SQLLiteSpy here. I'd think these steps would work in any SQL Lite viewer but I'm not familiar with others.
2. Paste the following code into the statement box. Replace the blue text with the table you want to create your XML file from and the red text with the prefix you used in your 'Type' column.
Code:
CREATE TABLE XML_Merge (text_XML string);
INSERT INTO XML_Merge (text_XML)
SELECT
'<Row Tag="' || Description || '"><Text>'
|| LOWER(REPLACE(REPLACE(Type, '[COLOR="Red"]BUILDING_[/COLOR]',''),'_',' '))
|| '</Text></Row>'
|| '<Row Tag="' || Help || '"><Text>'
|| LOWER(REPLACE(REPLACE(Type, '[COLOR="red"]BUILDING_[/COLOR]',''),'_',' '))
|| ' help</Text></Row>'
|| '<Row Tag="' || Strategy || '"><Text>'
|| LOWER(REPLACE(REPLACE(Type, '[COLOR="red"]BUILDING_[/COLOR]',''),'_',' '))
|| ' strategy</Text></Row>'
|| '<Row Tag="' || Civilopedia || '"><Text>'
|| LOWER(REPLACE(REPLACE(Type, '[COLOR="red"]BUILDING_[/COLOR]',''),'_',' '))
|| ' civilopedia</Text></Row>' FROM [COLOR="Blue"]Buildings[/COLOR];
Spoiler :
3. Go to Execute -> Execute SQL (F9).
2. Go to XML_Merge table and copy contents. Click on a row, press Control-A to select all and then copy.
Spoiler :
3. Go to http://titlecapitalization.com/, paste your content in the text box. It will automatically capitalize it. Then copy text back from the box.
Spoiler :
4. Paste inside new XML file that's set up like this:
Code:
<GameData>
<Language_en_US>
[COLOR="red"]--paste here--[/COLOR]
</Language_en_US>
</GameData>
5. Delete the top line of the pasted code ("text_XML")
Spoiler :
6. This file would be easier to read if there were more line breaks between rows. Go to find/replace (Control-H). Check the box 'Use Regular Expressions'. Do the following:
Find: \/Row\> \<Row Replace: \/Row\>\n\n\t\t\<Row
Find: \/Row\>\<Row Replace: \/Row\>\n\t\t\<Row
Find: \/Row\>\<Row Replace: \/Row\>\n\t\t\<Row
Spoiler :
7. Your file should be ready to use.
Spoiler :
NOTE: If you're doing this more than once, you need to run following SQL code prior to starting.
Code:
DROP TABLE XML_Merge;