Get Text into Game via XML

ruff_hi

Live 4ever! Or die trying
Joined
Oct 24, 2005
Messages
9,135
Location
an Aussie in Boston
I'm stuck. I have this code ...

Code:
from BugOptions import OptionsFacade, Option, OptionList								
from CvPythonExtensions import *
localText = CyTranslator()
					
class BugAlertsOptions(OptionsFacade):								
								
	def __init__(self):							
		OptionsFacade.__init__(self)						
								
		zs_Text = localText.getText("TXT_KEY_BUGOPTIONS_ALERT_REMINDERS_TEXT", ())
		zsHover = localText.getText("TXT_KEY_BUGOPTIONS_ALERT_REMINDERS_HOVER", ())

... which is trying to read data from an XML file.

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!--
  Copyright (c) 2007, BUG Mod.

  This file is part of Civilization IV BUG Mod.
  -->

<Civ4GameText xmlns="http://www.firaxis.com">
	<!-- BUG Option Screen Text -->
	<TEXT>
		<Tag>TXT_KEY_BUGOPTIONS_ALERT_REMINDERS_TEXT</Tag>
		<English>Enable Reminders (Alt-M)</English>
		<French>Enable Reminders (Alt-M)</French>
		<German>Enable Reminders (Alt-M)</German>
		<Italian>Enable Reminders (Alt-M)</Italian>
		<Spanish>Enable Reminders (Alt-M)</Spanish>
	</TEXT>

...

	</TEXT>
</Civ4GameText>

... but all I get on screen is the 'TXT_KEY_BUGOPTIONS_ALERT_REMINDERS_TEXT' text. I guess I am doing something wrong but I cannot see it. The XML log reports that the file loads ok. HELP!
 
stupid Civ4 - I copied the above text (localtext.gettext) to a different file and it worked, no ifs buts or maybes. I copied some text that I know works to the BUGOptions file and it stopped working. This tells me that I don't have a coding issue.

Other reasons for not working?

- maybe the __init__ is firing too early and the XML file isn't loaded in time
- I don't know what I am doing

My bet is that it is number 2!
 
I noticed on occasions, that the civ4 xml parser does choke on comments from time to time.
 
Back
Top Bottom