Eine Nachricht ins Log schreibst du so:
Ganz oben unter die "import"-Zeilen schreibst du:
PHP-Code:
localText = CyTranslator()
Dann kannst du an der gewünschten Stelle folgendes einfügen:
getText holt dir hier einen Textschlüssel in der Spielsprache aus der XML.
PHP-Code:
message = localText.getText("TXT_KEY_BLABLUBB", ())
CyInterface().addMessage(CyGame().getActivePlayer(), True, 10, message, None, 2, None, ColorTypes(8), 0, 0, False, False)
Ein Popup könntest du so machen:
Funktion aus dem Wüstenkrieg-Szenario:
PHP-Code:
def displayPopup( self, strText, argsList ):
"""Displays a pop-up message with strText as XML tag for the body and strText_TITLE as title;
text may contain a variable."""
popup = PyPopup.PyPopup()
popup.setHeaderString( localText.getText(strText + "_TITLE", ()) )
popup.setBodyString( localText.getText(strText, argsList) )
popup.launch()
Diese Funktion wird im weiteren Programm so aufgerufen:
PHP-Code:
self.displayPopup("TXT_KEY_POPUP_BLABLUBB", ())