A strange error

TheLopez

Deity
Joined
Jan 16, 2006
Messages
2,525
Location
Oregon
Has anyone gotten this error before?
Traceback (most recent call last):
File "CvTranslator", line 50, in finishText
OverflowError
:
Ä arg not in range(0x10000) (narrow Python build)

ERR: Python function finishText failed, module CvTranslator

If you have how were you able to resolve it?
 
TheLopez said:
Has anyone gotten this error before?


If you have how were you able to resolve it?

I havent seen it, can you post your cvtranslator?
 
I am perhaps still out-subject and I don't remember the exact error I had. But i got a similar error trying to translate a string that contain only a numer : "12" for an example .
 
Basically, I have updated the font TGA file with a new icon after the power icon. Update the CvEnums.h file in the SDK to have CROWN_CHAR after the POWER_CHAR entry and the CyEnumsInterface.cpp file to have .value("CROWN_CHAR", CROWN_CHAR) after the POWER_CHAR entry.

In the CyTranslator file I have added:
"[ICON_CROWN]" : FontSymbols.CROWN_CHAR

after the POWER_CHAR entry.

In the CyUtil.py file I have added:
'crown' : FontSymbols.Dynasty,

after the POWER_CHAR entry.
 
TheLopez said:
Basically, I have updated the font TGA file with a new icon after the power icon. Update the CvEnums.h file in the SDK to have CROWN_CHAR after the POWER_CHAR entry and the CyEnumsInterface.cpp file to have .value("CROWN_CHAR", CROWN_CHAR) after the POWER_CHAR entry.

In the CyTranslator file I have added:
"[ICON_CROWN]" : FontSymbols.CROWN_CHAR

after the POWER_CHAR entry.

In the CyUtil.py file I have added:
'crown' : FontSymbols.Dynasty,

after the POWER_CHAR entry.

Can you attach your cvtranslator.py?
 

Attachments

If you use the following in your finishText does it resolve the issue?

Code:
def finishText(argsList):

	szString = argsList[0]
	
	# FONT TAGS
	listMatches = re.findall("\\[ICON_.*?\\]", szString)
	for szMatch in listMatches:
[b]		if szMatch != "[ICON_CROWN]":[/b]
			if IconMap.has_key(szMatch):
				szReplacement = u"%c" % CyGame().getSymbolID(IconMap[szMatch])
			elif (szMatch == "[ICON_GOLD]"):
				szReplacement = u"%c" % gc.getCommerceInfo(CommerceTypes.COMMERCE_GOLD).getChar()
			elif (szMatch == "[ICON_RESEARCH]"):
				szReplacement = u"%c" % gc.getCommerceInfo(CommerceTypes.COMMERCE_RESEARCH).getChar()
			elif (szMatch == "[ICON_CULTURE]"):
				szReplacement = u"%c" % gc.getCommerceInfo(CommerceTypes.COMMERCE_CULTURE).getChar()
			elif (szMatch == "[ICON_FOOD]"):
				szReplacement = u"%c" % gc.getYieldInfo(YieldTypes.YIELD_FOOD).getChar()
			elif (szMatch == "[ICON_PRODUCTION]"):
				szReplacement = u"%c" % gc.getYieldInfo(YieldTypes.YIELD_PRODUCTION).getChar()
			elif (szMatch == "[ICON_COMMERCE]"):
				szReplacement = u"%c" % gc.getYieldInfo(YieldTypes.YIELD_COMMERCE).getChar()
			else:
				szReplacement = u""
				print ("can't find font symbol %s in font map" % szMatch)
 
Kael said:
If you use the following in your finishText does it resolve the issue?

Code:
def finishText(argsList):

	szString = argsList[0]
	
	# FONT TAGS
	listMatches = re.findall("\\[ICON_.*?\\]", szString)
	for szMatch in listMatches:
[b]		if szMatch != "[ICON_CROWN]":[/b]
			if IconMap.has_key(szMatch):
				szReplacement = u"%c" % CyGame().getSymbolID(IconMap[szMatch])
			elif (szMatch == "[ICON_GOLD]"):
				szReplacement = u"%c" % gc.getCommerceInfo(CommerceTypes.COMMERCE_GOLD).getChar()
			elif (szMatch == "[ICON_RESEARCH]"):
				szReplacement = u"%c" % gc.getCommerceInfo(CommerceTypes.COMMERCE_RESEARCH).getChar()
			elif (szMatch == "[ICON_CULTURE]"):
				szReplacement = u"%c" % gc.getCommerceInfo(CommerceTypes.COMMERCE_CULTURE).getChar()
			elif (szMatch == "[ICON_FOOD]"):
				szReplacement = u"%c" % gc.getYieldInfo(YieldTypes.YIELD_FOOD).getChar()
			elif (szMatch == "[ICON_PRODUCTION]"):
				szReplacement = u"%c" % gc.getYieldInfo(YieldTypes.YIELD_PRODUCTION).getChar()
			elif (szMatch == "[ICON_COMMERCE]"):
				szReplacement = u"%c" % gc.getYieldInfo(YieldTypes.YIELD_COMMERCE).getChar()
			else:
				szReplacement = u""
				print ("can't find font symbol %s in font map" % szMatch)

Yeah, that would take care of the issue... It would basically not show the new crown icon... it would just skip it which fixes the issue but is not what I want it to do. What I want it to do is show the new crown icon that I have added to the font TGA file and defined in the FontSymbols Enum in the SDK.

If you look at the IconMap dictionary the ICON_CROWN icon is defined in there.
 
TheLopez said:
Yeah, that would take care of the issue... It would basically not show the new crown icon... it would just skip it which fixes the issue but is not what I want it to do. What I want it to do is show the new crown icon that I have added to the font TGA file and defined in the FontSymbols Enum in the SDK.

If you look at the IconMap dictionary the ICON_CROWN icon is defined in there.

Yeah I was just curious if it was having problems because it was being passed the ICON_CROWN or if it was having problems with the larger IconMap. If you have tested and shown that blocking on ICON_CROWN fixes the problem then you're having an issue pushing ICON_CROWN into getSymbolID.

Hmm.. So if getSymbolID is being passed 24 value and posting an overflow error (aka: thats to many) even after having the new entry defined in CvEnums.h then it smells like you may be dealing with a hard coded value in the exe.

I pulled c.fe's source cause I know he added a new "mana" commerce type to see if he defined it in cvenums.h, he didn't.
 
RogerBacon said:
Do you need to do all of that to add a new icon? I added the Shinto icon and I didn't have to do all of that.

Roger Bacon

But didn't you replace a religion with the shinto religion?
 
RogerBacon said:
Do you need to do all of that to add a new icon? I added the Shinto icon and I didn't have to do all of that.

Roger Bacon

Roger, I downloaded the mod and the Shinto icon is not read from the GameFont.tga or GameFont_75.tga files. You can confirm this be moving the res directory in the Assets folder to your desktop and running a game. The Shinto icons still appear.
 
TheLopez said:
Roger, I downloaded the mod and the Shinto icon is not read from the GameFont.tga or GameFont_75.tga files. You can confirm this be moving the res directory in the Assets folder to your desktop and running a game. The Shinto icons still appear.

If it's not being read from the .tga files how is the game finding it? I'm not sure what you are trying to do exactly, except get a new icon to appear in-game, but I'd be surprised if we need to code that into the DLL.

Roger Bacon
 
RogerBacon said:
If it's not being read from the .tga files how is the game finding it?
There is a set of buttons in the art\interface\Buttons\religions directory that are being used. Like I said before, just move the files from the assets\res directory out of the mod and fire up the mod. You'll see the the shinto related icons are still used.

RogerBacon said:
I'm not sure what you are trying to do exactly, except get a new icon to appear in-game, but I'd be surprised if we need to code that into the DLL.

Roger Bacon
I am trying to get a new CHAR in the game that can be mapped to an ICON through python. I can use [ICON_CROWN] in the XML like you can with[ICON_BULLET]. Also I need it so I can display it like a character of text in the game interface screens like the main interface and city interface screens. I have already tried the SDK route, it's what caused the error in the first place. If you are interested in looking at the files I used to generate the error I can PM you the link to them.
 
FYI, it is not possible to do what I am trying to do in Civ4 v1.61. Thank you all for trying to help out.
 
Back
Top Bottom