View Full Version : Question about Religion Adviser Screen (Python)


Fintilgin
Jul 29, 2007, 11:51 AM
Hello, I'm screwing around with modifying some files and I'm working with the religious adviser screen from Eusebius' World Religion Mod.

There's a sequence that looks like this:


# Religion buttons at the top
xLoop = self.X_RELIGION_START
for i in range(gc.getNumReligionInfos()):
if (gc.getPlayer(self.iActivePlayer).canDoReligion(i) ): #EWR: Only list ones player can convert to
szButtonName = self.getReligionButtonName(i)
if gc.getGame().getReligionGameTurnFounded(i) >= 0:
screen.addCheckBoxGFC(szButtonName, gc.getReligionInfo(i).getButton(), ArtFileMgr.getInterfaceArtInfo("BUTTON_HILITE_SQUARE").getPath(), self.X_RELIGION_AREA + xLoop - self.BUTTON_SIZE/2, self.Y_RELIGION_AREA + self.Y_RELIGION - self.BUTTON_SIZE/2, self.BUTTON_SIZE, self.BUTTON_SIZE, WidgetTypes.WIDGET_GENERAL, -1, -1, ButtonStyles.BUTTON_STYLE_LABEL)
else:
screen.setImageButton(szButtonName, gc.getReligionInfo(i).getButtonDisabled(), self.X_RELIGION_AREA + xLoop - self.BUTTON_SIZE/2, self.Y_RELIGION_AREA + self.Y_RELIGION - self.BUTTON_SIZE/2, self.BUTTON_SIZE, self.BUTTON_SIZE, WidgetTypes.WIDGET_GENERAL, -1, -1)
szName = self.getReligionTextName(i)
szLabel = gc.getReligionInfo(i).getDescription()
# if (self.iReligionSelected == i):
# szLabel = localText.changeTextColor(szLabel, gc.getInfoTypeForString("COLOR_YELLOW"))
screen.setText(szName, szArea, szLabel, CvUtil.FONT_CENTER_JUSTIFY, xLoop + self.X_RELIGION_AREA, self.Y_RELIGION_AREA + self.Y_RELIGION_NAME, 2*self.DZ, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
xLoop += self.DX_RELIGION


Now the bit that says -- if (gc.getPlayer(self.iActivePlayer).canDoReligion(i) ): -- right at the top seems to limit the religions displayed to those that the player can switch too.

I'd like to change this line so that it only displays the religions that have been founded, regardless of if the player can switch to them, so if only Hinduisim and Buddhism have been founded, those are all that will show up on the religion screen.

Can any of you python wizards tell me how this might work, or what I can change to make it display the way I want?

Jeckel
Jul 30, 2007, 12:05 PM
Just from looking at the code you posted I would say change
if (gc.getPlayer(self.iActivePlayer).canDoReligion(i) ):
to
if (CyGame().isReligionFounded(i)):

Ekmek
Nov 08, 2007, 11:05 AM
Did this work Flintlgin?

I'd like to do a religion screen but based off the espionage screen so it has the scroll bar on the left and only displays religions founded.

In case people care I want to have 40+ religions selectable but only 7 (or so) religions founded in a game. So each time I play its seven random religions of the 40 that show.

and of course I want to do this for corporations as well (but not only 7)

thx