Need help understanding some python (AttitudeUtil.py)

Tholal

Emperor
Joined
May 19, 2009
Messages
1,676
I'm trying to merge a large mod into my mod and have run into some issue with the game hanging on startup. The only error message I can get it to generate relates to the following code, specifically, the line highlighted.

Code:
def initModifiers (argsList=None):
	""" Creates the dictionary that maps strings to modifier keys. """
	global MODIFIER_STRING_TO_KEY
	MODIFIER_STRING_TO_KEY = {}
	for sKey in ATTITUDE_MODIFIERS:
		sStr = BugUtil.getPlainText(sKey, "NONE")
		if (sStr != "NONE"):
			# These modifier strings should contain the '%d: ' prefix
			# so we need to extract just the portion in quotes.
			pMatch = re.match(u"^.*(\".+\")", sStr, re.UNICODE)
			if (pMatch):
				MODIFIER_STRING_TO_KEY[unicode(pMatch.group(1))] = sKey
	for iMemType in range(MemoryTypes.NUM_MEMORY_TYPES):
[COLOR="RoyalBlue"][B]		sKey = str(gc.getMemoryInfo(iMemType).getTextKey())[/B][/COLOR]
		sStr = BugUtil.getPlainText(sKey, "NONE")
		if (sStr != "NONE"):
			# These modifier strings have no extra text and so
			# we can use them directly
			MODIFIER_STRING_TO_KEY[unicode(sStr)] = sKey
	#BugUtil.debug(u"initModifiers() MODIFIER_STRING_TO_KEY = %s" % str(MODIFIER_STRING_TO_KEY))

This function is in AttitudeUtil.py from BUG.

Error message (python):
Code:
Traceback (most recent call last):
  File "BugInit", line 93, in callInits
  File "BugUtil", line 608, in __call__
  File "BugUtil", line 605, in call
  File "AttitudeUtil", line 98, in init
  File "AttitudeUtil", line 202, in initModifiers
RuntimeError: Access violation - no RTTI data!

If I understand the message correctly, it's hitting some bad values when trying to access the MEMORY data? If so, what could be causing this? I have the same MEMORY types defined in enums.h and memoryinfos.xml. Am I missing something? Any help would be appreciated!
 
The only thing that comes to mind right now: Do all of the Description values for all of the MemoryInfo entires actually exist (in a file in the Text folder)?
 
The only thing that comes to mind right now: Do all of the Description values for all of the MemoryInfo entires actually exist (in a file in the Text folder)?

Yes. They are all base BTS memories except for 3 new ones for FFH. The new ones do have text in place and the base ones have text in the BTS folder.
 
Turns out my issue with the game hanging on start was an inadvertent infinite loop in the python code that displays the scoreboard.

I never did figure out what caused this weird memoryinfo error, but it seems to have also gone away.
 
Back
Top Bottom