Persistent WRECK error when compiling module_troops.py

Users who are viewing this thread

I'm having an issue compiling my module with WRECK 1.1.2. Once it reaches the troops in modules_troops, it immediately errors out. The declaration for the troop seems accurate, so I'm not sure why it's failing. Having looked at the compiler code, it's a pretty complicated class, and I'm unsure why it's trying to delve into the attributes of a declared integer.
Screenshot-2024-04-05-051236.png%22

The error points to the following class in the compiler:

Code:
# Generic class which is used to quietly replace some pipe-joined lists in the game (particularly, item property list and troop attribute/skill/proficiency lists)
class AGGREGATE(dict):
    def __or__(self, other):
        if not other: return self
        result = AGGREGATE(self)
        for key, value in other.items():
            if type(value) == float: result[key] = max(result.get(key, 0.0), value)
            else: result[key] = result.get(key, 0) | value
        #result.update(other)
        return result
    __ror__ = __radd__ = __add__ = __or__

Another useful function for troop processing is provided below
Code:
def process_troops(e, index):
    result = ['trp_%s %s %s %s %s %s %s %d %s %s' % (compiled_identifier(e[0], 'troop'), external_string(e[1]), external_string(e[2]), external_string(e[13]), e[3], e[4], e[5], parse_int(e[6]), parse_int(e[14]), parse_int(e[15]))]
    result.append('  ' + ''.join([('%d %d ' % ((parse_int(e[7][i][0]), e[7][i][1] << 24) if i < len(e[7]) else (-1, 0))) for i in range(64)]))
    if not isinstance(e[8], AGGREGATE): e[8] = unparse_attr_aggregate(e[8])
    if not isinstance(e[9], AGGREGATE): e[9] = unparse_wp_aggregate(e[9])
    result.append('  %d %d %d %d %d' % (e[8].get('str', 0), e[8].get('agi', 0), e[8].get('int', 0), e[8].get('cha', 0), e[8].get('level', 0)))
    result.append((' %d' * num_weapon_proficiencies) % tuple([e[9][index] for index in range(num_weapon_proficiencies)]))
    result.append(''.join(['%d ' % ((parse_int(e[10]) >> (32*i))&0xffffffff) for i in range(num_skill_words)]))
    face_words = []
    for face_key in (e[11], e[12]):
        word_keys = []
        for word_no in range(4):
            word_keys.append((face_key >> (64 * word_no)) & 0xFFFFFFFFFFFFFFFF)
        for word_no in range(4):
            face_words.append("%d "%(word_keys[3 - word_no]))
    result.append('  %s\r\n' % ''.join(face_words))
    return '\r\n'.join(result)
 
Last edited:
Aye,

Did you add any troop? An error that occurs if you forgot to put a comma after the imobits codes or forgot "[]" any of these. If you have added any troop, I can help you if you post its line.


 
Last edited:
Back
Top Bottom