Dancing Hoskuld
Deity
I seem to be doing something wrong with the BugUtil getTexT function when I have more than one parameter or have character (string variables).
The message I want out is:-
"From killing Rhinoceros, 3 food and 3 hammers has been delivered to Mecca."
where each bolded bit is created in the python to fit into the GameText message.
The code for creating the three food and 3 hammers bit:-
The trace results:-
I forgot to trace what the final BUG version was in this test.
The message I want out is:-
"From killing Rhinoceros, 3 food and 3 hammers has been delivered to Mecca."
where each bolded bit is created in the python to fit into the GameText message.
Code:
<TEXT>
<Tag>TXT_KEY_SUBDUED_KILL_MESSAGE</Tag>
<English>From killing %s, %s has been delivered to %s.</English>
... </TEXT>
The code for creating the three food and 3 hammers bit:-
Code:
sFoodMessage = ''
sHammerMessage = ''
sAndMessage = ''
if (iHammers > 0):
pClosestCity.changeProduction(iHammers)
if (iHammers > 1):
sHammerMessage = '%d hammers' %(iHammers)
sBugHammerMessage = BugUtil.getText("TXT_KEY_SUBDUED_MANY_HAMMERS",iHammers)
else:
sHammerMessage = 'one hammer'
sBugHammerMessage = BugUtil.getText("TXT_KEY_SUBDUED_ONE_HAMMER")
sReturnMessage = sHammerMessage
if (iFood > 0):
pClosestCity.changeFood(iFood)
if (iFood > 1):
sFoodMessage = '%d food' %(iFood)
sBugFoodMessage = BugUtil.getText("TXT_KEY_SUBDUED_MANY_FOOD",iFood)
else:
sFoodMessage = 'one food'
sBugFoodMessage = BugUtil.getText("TXT_KEY_SUBDUED_ONE_FOOD")
sReturnMessage = sHammerMessage
if (iFood > 0) and (iHammers > 0):
sReturnMessage = '%s and %s' %(sFoodMessage, sHammerMessage)
sBugReturnMessage = BugUtil.getText("TXT_KEY_SUBDUED_AND", (sFoodMessage, sHammerMessage))
BugUtil.debug("Subdue Animals - FoodMessage %s", sBugFoodMessage)
BugUtil.debug("Subdue Animals - BugFoodMessage %s", sBugFoodMessage)
BugUtil.debug("Subdue Animals - HammerMessage %s", sBugHammerMessage)
BugUtil.debug("Subdue Animals - BugHammerMessage %s", sBugHammerMessage)
BugUtil.debug("Subdue Animals - ReturnMessage %s", sReturnMessage)
BugUtil.debug("Subdue Animals - BugReturnMessage %s", sBugReturnMessage)
The trace results:-
Code:
11:58:54 DEBUG: Subdue Animals - onCombatResult called.
11:58:54 DEBUG: Subdue Animals - FoodMessage 38454076 food
11:58:54 DEBUG: Subdue Animals - [B]Bug[/B]FoodMessage 38454076 food
11:58:54 DEBUG: Subdue Animals - HammerMessage 38454076 hammers
11:58:54 DEBUG: Subdue Animals - [B]Bug[/B]HammerMessage 38454076 hammers
11:58:54 DEBUG: Subdue Animals - ReturnMessage 3 food and 3 hammers
11:58:54 DEBUG: Subdue Animals - [B]Bug[/B]ReturnMessage `JM and
11:58:54 DEBUG: Subdue Animals - From killing Rhinoceros, 3 food and 3 hammers has been delivered to Mecca.
I forgot to trace what the final BUG version was in this test.