GP Tech Lightbulb Idea

Well - for what it is worth, here are the vanilla and warlords versions. Both of them give me errors that I haven't been able to track down.

Code:
ERR: Python function showTechChooser failed, module CvScreensInterface
Traceback (most recent call last):
  File "CvScreensInterface", line 612, in forceScreenUpdate
  File "CvTechChooser", line 644, in updateTechRecords
IndexError
: 
list index out of range

The code in question ...

Code:
	def updateTechRecords (self, bForce):

		# If we are the Pitboss, we don't want to put up an interface at all
		if ( CyGame().isPitbossHost() ):
			return
			
		# Get the screen
		screen = CyGInterfaceScreen( "TechChooser", CvScreenEnums.TECH_CHOOSER )
	
		abChanged = []
		bAnyChanged = 0
	
		# Go through all the techs
		for i in range(gc.getNumTechInfos()):
		
			abChanged.append(0)
		
			if ( gc.getTeam(gc.getPlayer(self.iCivSelected).getTeam()).isHasTech(i) ):
				if ( self.aiCurrentState[i] != CIV_HAS_TECH ):
					self.aiCurrentState[i] = CIV_HAS_TECH
					abChanged[i] = 1
					bAnyChanged = 1
			elif ( gc.getPlayer(self.iCivSelected).getCurrentResearch() == i ):
				if ( self.aiCurrentState[i] != CIV_IS_RESEARCHING ):
					self.aiCurrentState[i] = CIV_IS_RESEARCHING
					abChanged[i] = 1
					bAnyChanged = 1

I think the error has something to do with being out of range but that makes no sense to me.

Note: the above warlords version might still have some advancestart code in it. I did remove it and got the same error, not sure if I correctly saved the version with that part removed.
 
I kept getting this same error a lot. The problem is that the screen itself is created as the game is starting up, and something in interfaceScreen() is causing this to fail. Part of that code is creating the arrays that are accessed later in updateTechRecords().

To fix it on my end I had to make sure that the TechPrefs isn't created on the first call to interfaceScreen(). That's why I put create it in updateTechPrefs(). You have it the same way, so this shouldn't be the problem.

The arrays are created by placeTechs() which is called from interfaceScreen(). Look for a way that interfaceScreen() could fail before line 121. The only addition I see is

Code:
self.NO_TECH_ART = ArtFileMgr.getInterfaceArtInfo("INTERFACE_BUTTONS_CANCEL").getPath()

Does this art file exist in both Vanilla and Warlords? I pulled it from the religion screen, which should exist in both. When exactly does it fail? Starting a game? Loading one? Or do those work but it fails wben you hit F6? Do you end up with an empty TechChooser screen?

When I was having the problems, starting and loading both ended up with a blank TechChooser screen with only the Engineer button showing. I feel your pain. This was the worst part for me since there's no error message for what initially causes the arrays not to be created. I think the reason is because it's during preGameStart() that there are no error messages -- logging hasn't been enabled yet.
 
When exactly does it fail? Starting a game? Loading one? Or do those work but it fails wben you hit F6? Do you end up with an empty TechChooser screen?
Everything starts up ok but I get errors when I hit F6. The tech screen looks ok, but clicking on anything (except scroll bar and exit) gives me the errors again. I'll take a further look at the code and do my usual debugging route which is to comment everything out and slowly add stuff back in.

EmperorFool said:
I feel your pain.
"I feel your pain." What sort of comment is that? Are we a mutual self help group? How about "The solution is ..." or "let me fix it". :D
 
Back
Top Bottom