EmperorFool
Deity
It looks like you need to add an entry for your new control to an XML file. If there's a CvControlInfo, there must be a matching XML item for it. You may also need a shortcut for it? And Action? I dunno.
It looks like you need to add an entry for your new control to an XML file. If there's a CvControlInfo, there must be a matching XML item for it. You may also need a shortcut for it? And Action? I dunno.
//======================================================================================================
// CvControlInfo
//======================================================================================================
//------------------------------------------------------------------------------------------------------
//
// FUNCTION: CvControlInfo()
//
// PURPOSE : Default constructor
//
//------------------------------------------------------------------------------------------------------
CvControlInfo::CvControlInfo()
{
}
//------------------------------------------------------------------------------------------------------
//
// FUNCTION: ~CvControlInfo()
//
// PURPOSE : Default destructor
//
//------------------------------------------------------------------------------------------------------
CvControlInfo::~CvControlInfo()
{
}
bool CvControlInfo::read(CvXMLLoadUtility* pXML)
{
if (!CvHotkeyInfo::read(pXML))
{
return false;
}
return true;
}
<ControlInfo>
<Type>CONTROL_IDEOLOGY_SCREEN</Type>
<Description>TXT_KEY_IDEOLOGY_ADVISOR_TITLE</Description>
<Help/>
<HotKey>KB_F7</HotKey>
<bAltDown>0</bAltDown>
<bShiftDown>0</bShiftDown>
<bCtrlDown>1</bCtrlDown>
<iHotKeyPriority>0</iHotKeyPriority>
<HotKeyAlt/>
<bAltDownAlt>0</bAltDownAlt>
<bShiftDownAlt>0</bShiftDownAlt>
<bCtrlDownAlt>0</bCtrlDownAlt>
<iHotKeyPriorityAlt>0</iHotKeyPriorityAlt>
</ControlInfo>
The ideology advisor button appears to be bigger problem than I expected. I can't find a way to add an image to it. Does anyone know how to do it?
def drawIdeologyInfo(self, iIdeology):
screen = self.getScreen()
if (iIdeology == gc.getNumIdeologyInfos()):
iLinkIdeology = -1
else:
iLinkIdeology = iIdeology
szArea = self.AREA_ID
screen.addPanel(self.AREA_ID, "", "", True, True, self.X_INFO_AREA, self.Y_INFO_AREA, self.W_IDEOLOGY_AREA, self.H_INFO_AREA, PanelStyles.PANEL_STYLE_MAIN)
[COLOR="Red"]szHelpText = CyGameTextMgr().parseIdeologyInfo(iIdeology, False)[/COLOR]
szHelpAreaID = self.HELP_AREA_NAME
screen.addMultilineText(szHelpAreaID, szHelpText, self.X_INFO_AREA, self.Y_INFO_AREA, self.W_IDEOLOGY_AREA, self.H_INFO_AREA, WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
...
ERR: Python function showIdeologyScreen failed, module CvScreensInterface
Traceback (most recent call last):
File "CvScreensInterface", line 97, in showIdeologyScreen
File "CvIdeologyScreen", line 108, in interfaceScreen
File "CvIdeologyScreen", line 161, in drawIdeologyInfo
RuntimeError
:
unidentifiable C++ exception
Do you mean all files in Beyond the Sword/Resource/Themes/Civ4?How to set the button's image depends on how you draw the button. If you are using setStyle like the other advisor buttons, you need to define a new style in your mod's theme (copy all of the Civ4 theme files first I think).
I'll try that.What's the code for that CvGameTextMgr function? I can't possibly know why it's failing otherwise. My guess is that you're passing in an invalid value for iIdeology.
szHelpText = CyGameTextMgr().parseIdeologyInfo(iIdeology, False)
Start by trying other values for iIdeology such as 1 or 2. You should be able to pass in 0 to N - 1 where N is the number of ideologies.
def logToFile(message):
"""
Writes the message to the debug log with a time stamp if that option is enabled.
"""
if logTime:
message = time.asctime()[11:20] + message
if isinstance(message, unicode):
message = message.encode("iso8859")
sys.stdout.write(message + "\n")
self.iIdeologySelected = gc.getPlayer(self.iActivePlayer).getIdeology()
[COLOR="Red"]if (self.iIdeologySelected == -1):
self.iIdeologySelected = gc.getNumIdeologyInfos()[/COLOR]
self.iIdeologyExamined = self.iIdeologySelected
self.iIdeologyOriginal = self.iIdeologySelected
CyGameTextMgr().parseIdeologyInfo(iIdeology, False)
# Convert Button....
iLink = 0
if (gc.getPlayer(self.iActivePlayer).canChangeReligion()):
iLink = 1
if (not self.canConvert(iLinkReligion) or iLinkReligion == self.iReligionOriginal):
screen.setText(self.CONVERT_NAME, "Background", self.EXIT_TEXT, CvUtil.FONT_RIGHT_JUSTIFY, self.X_EXIT, self.Y_EXIT, self.Z_TEXT, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, 1, 0)
screen.hide(self.CANCEL_NAME)
szAnarchyTime = CyGameTextMgr().setConvertHelp(self.iActivePlayer, iLinkReligion)
else:
[COLOR="Red"]screen.setText(self.CONVERT_NAME, "Background", self.CONVERT_TEXT, CvUtil.FONT_RIGHT_JUSTIFY, self.X_EXIT, self.Y_EXIT, self.Z_TEXT, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_CONVERT, iLinkReligion, 1)[/COLOR]
screen.show(self.CANCEL_NAME)
szAnarchyTime = localText.getText("TXT_KEY_ANARCHY_TURNS", (gc.getPlayer(self.iActivePlayer).getReligionAnarchyLength(), ))
BugUtil.debug("Player %d is looking at ideology %d", ePlayer, iIdeology)