Religious Python Problem

Okay, so this says you modified the file and it is in play. If you have logging enabled, you should be able to open PythonErr.log and see something like "asdf is not a global attribute".

The thing is, it also didn't show the immediate message I had you add. Change it to this (and remove the asdf line):

Code:
if CyGame().isOption(GameOptionTypes.GAMEOPTION_PICK_RELIGION):
	[B]CvUtil.pyPrint("Option type %s is on" % str(GameOptionTypes.GAMEOPTION_PICK_RELIGION))[/B]
	if gc.getPlayer( iPlayer ).isHuman( ):

Then look in the file PythonDbg.log for that message (search for "Option type". If it's not there, I'm out of ideas. Something is messed up.

OK went back and re-tried both, the first one works for the religion, but again stops other python from happening (Subdue). Second one (Subdue works) but the religion does not.

There was nothing in the logs about Options either.

I guess is there just anyway to get rid of the pick religion stuff without messing with any other python stuff here???:blush:
 
I guess is there just anyway to get rid of the pick religion stuff without messing with any other python stuff here???:blush:

Yes, make the following changes:

Code:
	def onTechAcquired(self, argsList):
		'Tech Acquired'
		iTechType, iTeam, iPlayer, bAnnounce = argsList
			...
			if bHolyCity == False:

				#Found Religion
				[s]if CyGame().isOption(GameOptionTypes.GAMEOPTION_PICK_RELIGION):[/s]
					[s]if gc.getPlayer( iPlayer ).isHuman( ):[/s]
						[s]self.doPickReligionPopup(iPlayer, iRelCheck)[/s]
					[s]else:[/s]
						[s]iNewReligion = self.AI_chooseReligion(iPlayer)[/s]
						[s]if iNewReligion > -1:[/s]
							[s]gc.getPlayer(iPlayer).foundReligion(iNewReligion, iRelCheck, True)[/s]

				[s]else:[/s]
				[i]# shift next line left to line up with Found Religion comment above.[/i]
				gc.getPlayer(iPlayer).foundReligion(iRelCheck, iRelCheck, True)
				
		...
 
Yes, make the following changes:

Code:
	def onTechAcquired(self, argsList):
		'Tech Acquired'
		iTechType, iTeam, iPlayer, bAnnounce = argsList
			...
			if bHolyCity == False:

				#Found Religion
				[s]if CyGame().isOption(GameOptionTypes.GAMEOPTION_PICK_RELIGION):[/s]
					[s]if gc.getPlayer( iPlayer ).isHuman( ):[/s]
						[s]self.doPickReligionPopup(iPlayer, iRelCheck)[/s]
					[s]else:[/s]
						[s]iNewReligion = self.AI_chooseReligion(iPlayer)[/s]
						[s]if iNewReligion > -1:[/s]
							[s]gc.getPlayer(iPlayer).foundReligion(iNewReligion, iRelCheck, True)[/s]

				[s]else:[/s]
				[i]# shift next line left to line up with Found Religion comment above.[/i]
				gc.getPlayer(iPlayer).foundReligion(iRelCheck, iRelCheck, True)
				
		...


I just went back to an old mod file (months ago) and see what he changed and this is what he changed and what is causing it? So i just deleted the whole thing, i hope its ok, yours looks good also, i will try that also, and thx so much.

Code:
#Check if religious tech
		bRTech = False
		if iTechType == gc.getInfoTypeForString("TECH_MEDITATION"):
			iRelCheck = gc.getInfoTypeForString("RELIGION_BUDDHISM")
			if not gc.getGame().isReligionSlotTaken (iRelCheck):
				bRTech = True
		if iTechType == gc.getInfoTypeForString("TECH_POLYTHEISM"):
			iRelCheck = gc.getInfoTypeForString("RELIGION_HINDUISM")
			if not gc.getGame().isReligionSlotTaken (iRelCheck):
				bRTech = True
		if iTechType == gc.getInfoTypeForString("TECH_MONOTHEISM"):
			iRelCheck = gc.getInfoTypeForString("RELIGION_JUDAISM")
			if not gc.getGame().isReligionSlotTaken (iRelCheck):
				bRTech = True
		if iTechType == gc.getInfoTypeForString("TECH_THEOLOGY"):
			iRelCheck = gc.getInfoTypeForString("RELIGION_CHRISTIANITY")
			if not gc.getGame().isReligionSlotTaken (iRelCheck):
				bRTech = True
		if iTechType == gc.getInfoTypeForString("TECH_CODE_OF_LAWS"):
			iRelCheck = gc.getInfoTypeForString("RELIGION_CONFUCIANISM")
			if not gc.getGame().isReligionSlotTaken (iRelCheck):
				bRTech = True
		if iTechType == gc.getInfoTypeForString("TECH_PHILOSOPHY"):
			iRelCheck = gc.getInfoTypeForString("RELIGION_TAOISM")
			if not gc.getGame().isReligionSlotTaken (iRelCheck):
				bRTech = True
		if iTechType == gc.getInfoTypeForString("TECH_DIVINE_RIGHT"):
			iRelCheck = gc.getInfoTypeForString("RELIGION_ISLAM")
			if not gc.getGame().isReligionSlotTaken (iRelCheck):
				bRTech = True

		if bRTech == True:
			#Check if player already has Holy City
			bHolyCity = False
			lCities = PyPlayer( iPlayer ).getCityList( )
			for iCity in range( len( lCities ) ):
				pCity = gc.getPlayer( iPlayer ).getCity( lCities[ iCity ].getID( ) )
				for iReligionLoop in range( gc.getNumReligionInfos( ) ):
					if pCity.isHolyCityByType( iReligionLoop ):
						bHolyCity = True

			if bHolyCity == False:

				#Found Religion
				if CyGame().isOption(GameOptionTypes.GAMEOPTION_PICK_RELIGION):
					if gc.getPlayer( iPlayer ).isHuman( ):
						self.doPickReligionPopup(iPlayer, iRelCheck)
					else:
						iNewReligion = self.AI_chooseReligion(iPlayer)
						if iNewReligion > -1:
							gc.getPlayer(iPlayer).foundReligion(iNewReligion, iRelCheck, True)

				else:
					gc.getPlayer(iPlayer).foundReligion(iRelCheck, iRelCheck, True)
				
		if (not self.__LOG_TECH):
			return
		CvUtil.pyPrint('%s was finished by Team %d' 
			%(PyInfo.TechnologyInfo(iTechType).getDescription(), iTeam))
	
	def onTechSelected(self, argsList):
		'Tech Selected'
		iTechType, iPlayer = argsList
		if (not self.__LOG_TECH):
			return
		CvUtil.pyPrint('%s was selected by Player %d' %(PyInfo.TechnologyInfo(iTechType).getDescription(), iPlayer))
	
	def onReligionFounded(self, argsList):
		'Religion Founded'
		iReligion, iFounder = argsList
		player = PyPlayer(iFounder)
		
		iCityId = gc.getGame().getHolyCity(iReligion).getID()
		if (gc.getGame().isFinalInitialized() and not gc.getGame().GetWorldBuilderMode()):
			if ((not gc.getGame().isNetworkMultiPlayer()) and (iFounder == gc.getGame().getActivePlayer())):
				popupInfo = CyPopupInfo()
				popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
				popupInfo.setData1(iReligion)
				popupInfo.setData2(iCityId)
				popupInfo.setData3(1)
				popupInfo.setText(u"showWonderMovie")
				popupInfo.addPopup(iFounder)
		
		if (not self.__LOG_RELIGION):
			return
		CvUtil.pyPrint('Player %d Civilization %s has founded %s'
			%(iFounder, player.getCivilizationName(), gc.getReligionInfo(iReligion).getDescription()))

	def onReligionSpread(self, argsList):
		'Religion Has Spread to a City'
		iReligion, iOwner, pSpreadCity = argsList
		player = PyPlayer(iOwner)
		if (not self.__LOG_RELIGIONSPREAD):
			return
		CvUtil.pyPrint('%s has spread to Player %d Civilization %s city of %s'
			%(gc.getReligionInfo(iReligion).getDescription(), iOwner, player.getCivilizationName(), pSpreadCity.getName()))

	def onReligionRemove(self, argsList):
		'Religion Has been removed from a City'
		iReligion, iOwner, pRemoveCity = argsList
		player = PyPlayer(iOwner)
		if (not self.__LOG_RELIGIONSPREAD):
			return
		CvUtil.pyPrint('%s has been removed from Player %d Civilization %s city of %s'
			%(gc.getReligionInfo(iReligion).getDescription(), iOwner, player.getCivilizationName(), pRemoveCity.getName()))
				
	def onCorporationFounded(self, argsList):
		'Corporation Founded'
		iCorporation, iFounder = argsList
		player = PyPlayer(iFounder)
		
		if (not self.__LOG_RELIGION):
			return
		CvUtil.pyPrint('Player %d Civilization %s has founded %s'
			%(iFounder, player.getCivilizationName(), gc.getCorporationInfo(iCorporation).getDescription()))

	def onCorporationSpread(self, argsList):
		'Corporation Has Spread to a City'
		iCorporation, iOwner, pSpreadCity = argsList
		player = PyPlayer(iOwner)
		if (not self.__LOG_RELIGIONSPREAD):
			return
		CvUtil.pyPrint('%s has spread to Player %d Civilization %s city of %s'
			%(gc.getCorporationInfo(iCorporation).getDescription(), iOwner, player.getCivilizationName(), pSpreadCity.getName()))

	def onCorporationRemove(self, argsList):
		'Corporation Has been removed from a City'
		iCorporation, iOwner, pRemoveCity = argsList
		player = PyPlayer(iOwner)
		if (not self.__LOG_RELIGIONSPREAD):
			return
		CvUtil.pyPrint('%s has been removed from Player %d Civilization %s city of %s'
			%(gc.getReligionInfo(iReligion).getDescription(), iOwner, player.getCivilizationName(), pRemoveCity.getName()))
 
You sent me the file CvEventManager.py. Do you have this in (Custom)Assets\Python or some other location? I ask because I'm now wondering if you have two event managers, one extending the other.

If not, and you deleted everything that you posted, you will likely run into problems. If you do have two event managers, then it all depends on how you have this set up.
 
You sent me the file CvEventManager.py. Do you have this in (Custom)Assets\Python or some other location? I ask because I'm now wondering if you have two event managers, one extending the other.

If not, and you deleted everything that you posted, you will likely run into problems. If you do have two event managers, then it all depends on how you have this set up.

ok, now i went back and re-did it your stuff out, and i get the pick religious stuff still.
I never use the Custom stuff either.
 
Where are you modifying these files? Do you have a mod in the Mods folder with your changes, or are you modifying the files in the install folder's Assets folder?

The strange thing that I see is that in the basic Civ4 BtS CvEventManager.py file, there is no code to choose a religion. In fact, there are only two places that check the GAMEOPTION_PICK_RELIGION option:

  • Tech Chooser (shows a generic religion icon if on)
  • Main Interface (dunno why it's here, but shows a generic tech icon for each religion if on)
This tells me that it must be handled in the SDK. Does your mod have a custom SDK? If so, you'll need to modify it. If not, then you must have Pick Religion turned on.

As you said, you do not, so I am left to assume either you have a custom DLL or space aliens have inhabited your PC. :D
 
Where are you modifying these files? Do you have a mod in the Mods folder with your changes, or are you modifying the files in the install folder's Assets folder?

The strange thing that I see is that in the basic Civ4 BtS CvEventManager.py file, there is no code to choose a religion. In fact, there are only two places that check the GAMEOPTION_PICK_RELIGION option:

  • Tech Chooser (shows a generic religion icon if on)
  • Main Interface (dunno why it's here, but shows a generic tech icon for each religion if on)
This tells me that it must be handled in the SDK. Does your mod have a custom SDK? If so, you'll need to modify it. If not, then you must have Pick Religion turned on.

As you said, you do not, so I am left to assume either you have a custom DLL or space aliens have inhabited your PC. :D

Nope no dll at all, sorry.
here's what the Tech chooser has:
Code:
                                # Religions unlocked
				for j in range( gc.getNumReligionInfos() ):
					if ( gc.getReligionInfo(j).getTechPrereq() == i ):
						szFoundReligion = "FoundReligionButton" + str( ( i * 1000 ) + j )
						if gc.getGame().isOption(GameOptionTypes.GAMEOPTION_PICK_RELIGION):
							szButton = ArtFileMgr.getInterfaceArtInfo("INTERFACE_POPUPBUTTON_RELIGION").getPath()
						else:
							szButton = gc.getReligionInfo(j).getButton()
						screen.addDDSGFCAt( szFoundReligion, szTechRecord, szButton, iX + fX, iY + Y_ROW, TEXTURE_SIZE, TEXTURE_SIZE, WidgetTypes.WIDGET_HELP_FOUND_RELIGION, i, j, False )
						fX += X_INCREMENT
			
			
				for j in range( gc.getNumCorporationInfos() ):
					if ( gc.getCorporationInfo(j).getTechPrereq() == i ):
						szFoundCorporation = "FoundCorporationButton" + str( ( i * 1000 ) + j )
						screen.addDDSGFCAt( szFoundCorporation, szTechRecord, gc.getCorporationInfo(j).getButton(), iX + fX, iY + Y_ROW, TEXTURE_SIZE, TEXTURE_SIZE, WidgetTypes.WIDGET_HELP_FOUND_CORPORATION, i, j, False )
						fX += X_INCREMENT
					
				screen.show( szTechRecord )

btw, i never mess with the original files.
 
When you look at techs that normally found religions, does it show the specific religion's icon for each tech or a generic one?
 
The normal ones.

Okay, this confirms that the Pick Religion option is unset (correctly). Since you're using a stock DLL, the problem must be somewhere else in the Python.

Can you post all of the Python files you've modified as an archive? I can do a quick grep through them.
 
Okay, this confirms that the Pick Religion option is unset (correctly). Since you're using a stock DLL, the problem must be somewhere else in the Python.

Can you post all of the Python files you've modified as an archive? I can do a quick grep through them.

Nevermind, i used old python files.
 
Top Bottom