• Civilization 7 has been announced. For more info please check the forum here .

Religious Python Problem

strategyonly

C2C Supreme Commander
Joined
Mar 13, 2006
Messages
21,007
Location
MN
I need someone that knows python to find the problem in my religious status. I think its in the Maininterface but not sure.:confused:

Here's the problem, when i found a religion (lets say Hinduism) it gives me that religion plus the Holy City, thats just fine, but then it has a pop-up window that says which religion do you want (or words to that effect) and it gives a choice of non-founded religions at that time (ie, Buddhism/Christianity, etc) you then have to choose which one you want ALSO, plus it gives you the holy city. I need to get rid of this portion of the religious stuff.:mad:

Only people that really know their python pls inquire, thx, i really really need this, its really annoying. Plus it takes away from the game for other civs to found a religion. THX.:(

I can send you the file but i have alot of attachments on CFC already and only will send to those who want to do this, thx.
 
Check in your game settings if you have the option "pick religion" selected. That should be that.

Tcho !
 
Check in your game settings if you have the option "pick religion" selected. That should be that.

Tcho !

And where would that be? I cant find a pick religion anyplace??
 
Click the victory advisor (in game) , then click settings to have the list of options selected and check if "pick religion" is in the list.

Tcho !
 
Click the victory advisor (in game) , then click settings to have the list of options selected and check if "pick religion" is in the list.

Tcho !

OK this is what i have, and i see none of this, and i never check any of the boxes when i start a game.
 
The list of options is in the 4th screen shot. So you don't have pick religion. I don't know from what the problem comes.

Tcho !
 
What you are describing is exactly what happens when you activate the "pick religions" checkbox. You have confirmed that you do not have that checkbox activated. But, somehow in your local modifications, you must be triggering the same effect. You have not indicated what mods you have or what local changes you have. If you drop back to a full vanilla game, do you see this problem go away? Then try re-adding your local changes. Also, it may be possible to trace out how the "pick religions" checkbox works, and see if any of your local changes are accidentally changing it.
 
What you are describing is exactly what happens when you activate the "pick religions" checkbox. You have confirmed that you do not have that checkbox activated. But, somehow in your local modifications, you must be triggering the same effect. You have not indicated what mods you have or what local changes you have. If you drop back to a full vanilla game, do you see this problem go away? Then try re-adding your local changes. Also, it may be possible to trace out how the "pick religions" checkbox works, and see if any of your local changes are accidentally changing it.

Well actually that was quite a few months ago when i changed the python over i used it from another mod and me not knowing anything about python what so ever, so i have no idea even where to look or how. It does not happen for all religions just the older ones, i think.:crazyeye:

I tried regular BtS and it does NOT happen there.

EDIT: OK i deleted the pyhton i had there, then replaced it with Next War python and all the religious stuff worked, but i do need all the other python stuff, so PLS HELP!!!

EDIT EDIT: I think i might have found it, help, pls!!
Spoiler :

Code:
#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()))
 
Edit your post to use [ CODE ] ... [ /CODE ] tags instead of a spoiler. This will keep the formatting (indentation) which is very important in Python.
 
Edit your post to use [ CODE ] ... [ /CODE ] tags instead of a spoiler. This will keep the formatting (indentation) which is very important in Python.

THx, didnt know that, so anyone whats wrong with the code????:blush:
 
Can you show the full implementation of the onTechAcquired function? It's hard to tell what's wrong without the full context.
 
Can you show the full implementation of the onTechAcquired function? It's hard to tell what's wrong without the full context.

Dont know if this is what you want?
 
I just wanted you to post the full function:

Code:
	def onTechAcquired(self, argsList):
		'Tech Acquired'
		iTechType, iTeam, iPlayer, bAnnounce = argsList
		# Note that iPlayer may be NULL (-1) and not a refer to a player object
		
		# Show tech splash when applicable
		if (iPlayer > -1 and bAnnounce and not CyInterface().noTechSplash()):
			if (gc.getGame().isFinalInitialized() and not gc.getGame().GetWorldBuilderMode()):
				if ((not gc.getGame().isNetworkMultiPlayer()) and (iPlayer == gc.getGame().getActivePlayer())):
					popupInfo = CyPopupInfo()
					popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
					popupInfo.setData1(iTechType)
					popupInfo.setText(u"showTechSplash")
					popupInfo.addPopup(iPlayer)

		#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))

From reading this code, it seems that after checking that a religion should be founded, it looks to see if the player already as any holy city. If they have one, they do not found a religion.

However, once it determines that the player should found a religion, it looks at the game option for choosing religions. If not set, it doesn't ask. I can't see why it is asking you. Make absolutely sure you don't select this option when starting your game.
 
Try adding the bold line below and giving it a shot:

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

You should see "Option type 9 is on" appear on the screen just before you are asked to pick a religion. This tells you that either you had that option enabled when you started your game or you've changed your SDK in a broken way.

BTW, Conquest is a victory type like Time and Space. Pick Religion is a game option, like No Tech Brokering, Always War and Raging Barbarians. They are completely unrelated concepts.
 
Try adding the bold line below and giving it a shot:

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

You should see "Option type 9 is on" appear on the screen just before you are asked to pick a religion. This tells you that either you had that option enabled when you started your game or you've changed your SDK in a broken way.

BTW, Conquest is a victory type like Time and Space. Pick Religion is a game option, like No Tech Brokering, Always War and Raging Barbarians. They are completely unrelated concepts.

This is what i get???? Religions and Holy City. PS: Post #5 shows what i have checked.
 
I have no idea what's going on. According to the code you posted, you should never be allowed to have two holy cities. Also, it didn't print the message.

Are you absolutely sure that your playing with the code you posted? Try putting in an error there. After the line I bolded, type

Code:
asdf = asdfasdf

And see what happens. If you see the popup, then you aren't playing with that code.
 
I have no idea what's going on. According to the code you posted, you should never be allowed to have two holy cities. Also, it didn't print the message.

Are you absolutely sure that your playing with the code you posted? Try putting in an error there. After the line I bolded, type

Code:
asdf = asdfasdf

And see what happens. If you see the popup, then you aren't playing with that code.


Ok i just got the one religion and NO popup window at all, but then i didnt get one of my other python options (Subdue Animals) didnt work.
 
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.
 
Top Bottom