Oblivion Mod:Wrye Bash Mod Elements

The UESPWiki – Your source for The Elder Scrolls since 1995
Jump to: navigation, search

Some of the mod record structure data here is given in Wrye Bash mod element structure. This is simply a dump of Bash's code. However, since the dump is basically a template definition, it's (relatively) easier to read. Ideally these should be converted to regular format. But for now, the dump is trivial to do.

Example[edit]

What follows is the class definition for a FACT (Faction) record. Flag field prototypes are usually defined here (usually as 'flags'), and the data structure is defined by a MelSet object. Read and write operations are performed by the parent class, based on the template defined by the MelSet object. But as far as definition goes, all you care about is the MelSet structure, plus flags field. Note that elements are listed in Oblivion.esm subrecord order.

By the way, in python bare strings at the beginning of a class or structure are documentation strings, not code. Also, '#' marks the beginning of a comment field. On to definitions...

class MreFact(MelRecord):
    """Faction record."""
    type = 'FACT'
    flags = Flags(0L,Flags.getNames('hiddenFromPC','evil','specialCombat'))
    melSet = MelSet(
        MelString('EDID','eid'),
        MelString('FULL','full'),
        MelStructs('XNAM','Ii','relations',(FID,'faction'),'mod'),
        MelStruct('DATA','B',(flags,'flags',0L)),
        MelStruct('CNAM','f',('crimeGoldMultiplier',1)),
        MelGroups('ranks',
            MelStruct('RNAM','i','rank'),
            MelString('MNAM','male'),
            MelString('FNAM','female'),
            MelString('INAM','insignia'),),
        )

This tranlates to:

  • String eid from EDID record. Defaults to empty.
  • String full from FULL record. Defaults to empty.
  • Array relations from XNAM records
    • Formid faction. Defaults to none.
    • int mod. Defaults to 0.
  • flags (defined on fourth line) flags taken from DATA record, read as unsigned byte. Defaults to unsigned int 0.
  • float crimeGoldMultiplier from CNAM record. Defaults to 1.0.
  • Array ranks
    • int rank taken from RNAM record. defaults to 0
    • Stringr male taken from MNAM record. Default to empty/none.
    • String female taken from FMAN record. Defaults to empty/none.
    • Path string insignia taken from INAM record. Defaults to empty/none.

Flags[edit]

You can read the flag field bits from arguments to Flags.getNames(). If the names are bare strings, then they correspond to bits 0,1,2, etc. in order. If the flag argument is a tuple (e.g. (16,'hideRings'), then it's saying that bit 16 is 'hideRings'.

Mod Elements[edit]

MelBase

  • MelBase(RecType,attribute,default=None)

A raw data field. Not written if value == None.

MelFormid

  • MelFormid(RecType,attribute,default=None)

A formid field. Not written if value == None.

MelFormids

  • MelFormids(RecType,attribute,default=None)

An array of formids.

MelString

  • MelString(RecType,attribute,default=None)

A zero terminated string field. Not written if value == None.

MelStruct

  • MelStruct(RecType,format,*elements)

A structure record. Format is as given by Python:struct. E.g., Ifi is: unsigned 32-bit int, float, signed 32-bit int. The elements are additional arguments with one argument per unpacked structure element. A full element is 3 element tuple: (action,attribute,default). If default is not defined, then it is taken as zero. The action can either be 'FID' to indicate a formid or function or class name which will take the unpacked data as an element. Currently, when present this is always a flags prototype. If there is no action, then the action field is skipped. If there is only the attribute, then it can be presented just the attribute name, rather than the tuple.

MelStructs

  • MelStruct(RecType,format,attribute,*elements)

An array of structures. This exactly the same as the MelStruct, except structures are stored in an object array with the specified attribute.

MelGroup

  • MelStruct(attribute,*elements)

This is a like subset of the MelSet. It's a group of separate mod file subrecords that act as a single attribute. The subelements are themselves Mod Elements (e.g., MelString, MelStruct), and are typically presented on separate lines. The subelements are stored in a single object as 'attribute'. By default attribute is empty. If None of the subelements appear, then the structure will remain empty and will not be printed.

MelGroups

  • MelStruct(attribute,*elements)

Same as MelGroup, only attribute is now an array of groups.

MelModel

  • MelStruct(attribute='model',index=0)

A predefined MelGroup consisting (for index = 0) of

    MelString('MODL','path'),
    MelBase('MODB','modb'),
    MelBase('MODT','modt'),

If index == 2,3,4, then the corresponding types are used (MOD2,MO2B, etc.)