Trouble with writing civilopedia entries

thinkingnut

Warlord
Joined
Sep 18, 2013
Messages
146
Hi All,

Was wondering if anyone would know how to fix this. I'm currently trying to add some civilopedia entries into the game, and even though I've created the following excerpt in the file CIV4GameText_Civilopedia_BTS.xml:

<TEXT>
<Tag>TXT_KEY_CIV_AMBER_PEDIA</Tag>
<English>[BOLD]Background:[\BOLD][PARAGRAPH:1] When China’s economy crumbled due to having exhausted all of its natural resources in 2096, 1.5 billion people went into nation-wide revolt. Starvation, political strife and social uprisings upset the rest of the world’s financial systems and despite the enormous amounts of aid that the United Nations sent and various threats of economic and military intervention, there seemingly was no end to the rampant corruption and poverty that plagued the country. It wasn’t until 2099 that a new leader rose and quelled all the revolts, united the country once again, reformed and renamed the country to what is now known as Amber.[PARAGRAPH:2] It is not known whether “Neo-China”, as it is widely nicknamed by the West, will be able to reintegrate all of its former tremendous human, financial and industrial capital. It is not known what the new ruler, Warren, is planning for the the 22nd century. Speculations differ tremendously. Is he friend or foe, administrative genius or another puppet of the military? Time will tell.</English>
</TEXT>

And also the <Civilopedia>TXT_KEY_CIV_AMBER_PEDIA</Civilopedia> as part of my civ entry in my CIV4CivilizationInfos.xml file, when I try loading the game, I get these two error messages while the game is loading (the "Init XML (uncached)" bit), as attached below.

I click "ok" and the game still loads fine. When I look at the Civilopedia in-game though, what shows up is TXT_KEY_CIV_AMBER_PEDIA instead of the entry I wrote into CIV4GameText_Civilopedia_BTS.xml. This problem persists if I try similar tasks like making entries for my custom UU, UB, and leader head.

Any solutions or thoughts would be greatly appreciated! :)

Many thanks,
ThinkingNut
 

Attachments

It looks like your file is simply not read due to error(s) in the opening section. Try to take a valid civ text file from BtS and insert your new tags in it.
 
It looks like your file is simply not read due to error(s) in the opening section. Try to take a valid civ text file from BtS and insert your new tags in it.

Which text file do you mean? The one CivilisationInfos one, or the Civilopediatext one?

For the civilisationinfos, I tried copying the entry on China and editing it to fit my custom civ.

Cheers
 
The text one. Look at your error messages. The very first character of the very first line in this file is wrong.
 
The text one. Look at your error messages. The very first character of the very first line in this file is wrong.

Hm, I didn't know that was what it meant.

There should not be anything wrong with the first character of the first line in that file. I'm attaching three pictures so you can see.

Something is definitely amiss here. I experimented with putting "TXT_KEY_CIV_AMERICA_PEDIA" instead of the "TXT_KEY_CIV_AMBER_PEDIA", and it shows up fine in game without any problems. But despite me copying as closely to the way the text is structured in the CIV4GameText_Civilopedia_BTS file, it refuses to load properly in-game if I use "TXT_KEY_CIV_AMBER_PEDIA".

Thank you for your help and your promptness so far. I do really appreciate it. :)
 

Attachments

  • pic1.pdf
    pic1.pdf
    115.5 KB · Views: 49
  • pic2.pdf
    pic2.pdf
    145.2 KB · Views: 43
  • Screen Shot 2014-04-09 at 16.59.49.jpg
    Screen Shot 2014-04-09 at 16.59.49.jpg
    234.6 KB · Views: 76
Your file seems OK, but still it is not read. It's obvious from what you see in the Civilopedia. What tool do you use to edit the text file? Some text editors do not correctly save files in the appropriate encoded format. I suggest that you use Notepad++ (free programme).

I made a very small text file for you as a test: I simply copied the beginning of your text for TXT_KEY_CIV_AMBER_PEDIA. Extract it, open it but don't save it! Put it in the text folder and see if you can read that small text in the Civilopedia.
 
Your file seems OK, but still it is not read. It's obvious from what you see in the Civilopedia. What tool do you use to edit the text file? Some text editors do not correctly save files in the appropriate encoded format. I suggest that you use Notepad++ (free programme).

I made a very small text file for you as a test: I simply copied the beginning of your text for TXT_KEY_CIV_AMBER_PEDIA. Extract it, open it but don't save it! Put it in the text folder and see if you can read that small text in the Civilopedia.

AH HA! :clap: Your text worked perfectly, and your hint there prompted me to download TextWrangler (I was using TextEdit as a Mac user, and must have saved it in the wrong code) to recode my text file as Western (ISO Latin 1). Now it shows up perfectly in game.

Thank you so much, bro! :goodjob:
 

Attachments

  • Screen Shot 2014-04-10 at 11.46.42.jpg
    Screen Shot 2014-04-10 at 11.46.42.jpg
    261.5 KB · Views: 54
You were probably saving the files as UTF-8 with BOM. That "BOM" (Byte Order Mark, or something like that) is 2 bytes of stuff that get inserted at the start of the file. You could not see it because the editor you were using does not show them to you (since it reads them for it's own use, in theory). The really funny part is that a BOM is completely useless in a UTF-8 file since the byte order is strictly defined for that encoding, unlike the UTF-16 ans such where they bytes can be in different orders and therefore need a BOM to tell the program reading it which order is being used in this file.

So you were in a situation where the file was messed up by the presence of 2 bytes of data which your editor added and didn't show you and which was completely useless and should not have been there to begin with.

Whoever invented adding a BOM to a UTF-8 file was a moron.
 
You were probably saving the files as UTF-8 with BOM. That "BOM" (Byte Order Mark, or something like that) is 2 bytes of stuff that get inserted at the start of the file. You could not see it because the editor you were using does not show them to you (since it reads them for it's own use, in theory). The really funny part is that a BOM is completely useless in a UTF-8 file since the byte order is strictly defined for that encoding, unlike the UTF-16 ans such where they bytes can be in different orders and therefore need a BOM to tell the program reading it which order is being used in this file.

So you were in a situation where the file was messed up by the presence of 2 bytes of data which your editor added and didn't show you and which was completely useless and should not have been there to begin with.

Whoever invented adding a BOM to a UTF-8 file was a moron.

Ah, I see. Thank you for explaining the problem. I use TextWrangler now, and always save it in Western (Windows Latin 1) to avoid any more sneaky UTF coding attacks.
 
Back
Top Bottom