Paolo80
Chieftain
- Joined
- Dec 20, 2019
- Messages
- 85
Hello guys,
I want to add a message during game.
I wrote the following xml tag:
And in python event file
When heretic is created, it causes python error
In PythonDbg my alert writes e.g. (u'Ravenna', 'ERETICO').
I think the error is that getNameKey() returns a wstring type instead string type. Must I convert wstring into string? How can I do?
I want to add a message during game.
I wrote the following xml tag:
TXT_KEY_ERETICO
...
Heretic was reported near %s1
...
And in python event file
Code:
iCity = gc.getMap().findCity(xplot, yplot, pPlot.getUnit(1).getOwner(), TeamTypes.NO_TEAM, True, False, TeamTypes.NO_TEAM, DirectionTypes.NO_DIRECTION, CyCity())
print(iCity.getName(), "ERETICO")
message = CyTranslator().getText("TXT_KEY_ERETICO" %(iCity.getNameKey()), ())
CyInterface().addImmediateMessage(message, "")
When heretic is created, it causes python error
TypeError: not all arguments converted during string formatting
In PythonDbg my alert writes e.g. (u'Ravenna', 'ERETICO').
I think the error is that getNameKey() returns a wstring type instead string type. Must I convert wstring into string? How can I do?
Last edited: