Guide:FOMOD/ModuleConfigXML

From Step Mods | Change The Game
Delta c.png

FOMOD Guide

ModuleConfig.xml Reference

by: Step Modifications and community  | Forum Topic

Info-Logo.png

NOTE

The headings below are only named as such to help sectionalize the different areas of the script for reference purposes.

Script Header and Page Container

The "header" section referenced here is the beginning elements of the ModuleConfig script, which consists of following elements:

  • config
  • moduleName
  • requiredInstallFiles (optional)

The "page container" is the installSteps element that individual pages are nested within.

config Element

Just like the info.xml script, the ModuleConfig.xml script must start with a specific line of code. This time, it's the config element. This holds a very specific set of attributes, which tell the XML parser how to handle the file. Unlike the info.xml script, this starting tag must also be closed and all other elements within the the script will be nested within the config element. To get started,

  1. Navigate to the ModuleConfig.xml script and open it in a text editor
  2. Ensure the programming language is set to XML
  3. Ensure the encoding is set to UTF-16

Now it's time to include the config elements. Knowing what this element's attributes do is not important. Knowing that the tag must be included exactly as below, is! It's recommended to copy and paste this into the editor to ensure no mistakes are made:

<config xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://qconsulting.ca/fo3/ModConfig5.0.xsd">

</config>

moduleName Element

The moduleName tag holds the name of the module. This can be anything, but it's recommended to use the name of the mod which the FOMOD is being created for. This tag is nested below the config' tag. This tag is defined as such:

<config xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://qconsulting.ca/fo3/ModConfig5.0.xsd">
   <moduleName>The STEP Installer</moduleName>
</config>

The name of the module is placed between the opening and closing tags. For this guide, the moduleName is defined as The STEP Installer.

requiredInstallFiles Element

The requiredInstallFiles element's section is completely optional, meaning it does not need to be included within the ModuleConfig file. The reason any mod author would want to include this element's section is if the mod the installer is being written for requires files to be install, regardless of the options chosen by the user. These are normally files such as a ReadMe or files that the mod requires to function properly. For this guide, the STEP Compilation is being used as a reference; therefore, the included requiredInstallFiles section here includes files which are required for DynDOLOD to function properly with a STEP Guide installation.

The requiredInstallFiles element has an opening and closing tag; however, unlike most the the tags thus far, it only houses child elements: either a file element, a folder element, or multiple of each or both mixed. For this guide, it houses a single folder tag as such:

<config xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://qconsulting.ca/fo3/ModConfig5.0.xsd">
   <moduleName>The STEP Installer</moduleName>
   <requiredInstallFiles>
      <folder source="00 Required" destination="" priority="1"/>
   </requiredInstallFiles>
</config>

Within each file or folder tag are up to three attributes: source, destination, and priority. These attributes are always defined as attributeName="attributeValue"; where the value is always encased between quotation marks.

The source attribute always lists the path to the file or folder being installed from the mod's root folder. In the case of folders, this will always be a single level path, as seen in the example above. This means the entire contents of the "00 Required" folder will be installed to the Data directory in Skyrim. Therefore, within these folders users should have the proper folder structure for the assets being installed. When installing a single file, the path needs to be defined to the file's location within the directory structure and include the file name, itself. For example:

source="00 Required\textures\terrain\tamriel\trees\tamrieltreelod.dds"

The destination attribute defines the destination of where the file or folder from the source attribute's value will be installed. When installing a specific file, unless that file will be installed within the Data directory itself, the destination will be the path to the folder where that file should be installed, omitting the Data folder in the path. See the example below. When installing an entire folder rather than a file, most often it will be installed in the Data folder. In these cases, destination should not be defined because the default directory for this attribute is the Data folder, and is also the reason it's omitted from the path. Leaving this undefined, as in the example above, the folder or file will be installed into the Data folder.

   <requiredInstallFiles>
      <folder source="00 Required\textures\terrain\tamriel\trees\tamrieltreelod.dds" destination="textures\terrain\tamriel\trees\" priority="1"/>
   </requiredInstallFiles>

The priority attribute defines the priority in which files or folders from the entire FOMOD should be installed. The lower the number, the lower the priority will be during file/folder installation. This means a file or folder with a priority value of "1" will be installed before any other files or folder. A file or folder with a priority value of "2" will overwrite any file or folder with a priority or "1" or lower. Think of it as the installation order for the files and folders where the mod author can control the order in which the files are installed. This is useful for mean reasons. For example, if a mod author has a set of armor meshes and textures in the assets which are installed automatically with the requiredInstallFiles element but wants to provide compatibility with another armor mod retexture. The author can simply give those compatibility files a higher priority and the installer will overwrite the default textures with the compatible textures. Understanding how priorities work within a FOMOD script can be a powerful asset to make potentially complex FOMODs more simple. You can see in the examples above, the priority attribute was given a value of "1", for this guide. To suit their preferences, users can start from 0 or 1 for this value. The starting value isn't important as long as the priorities are set properly.

installSteps Element

The final element of the header section is the installSteps element. This element is similar to the config element above in that it contains all the FOMOD "pages" between its opening and closing tags. The installSteps tag contains one attribute, order, and should be defined as below. The order attribute with a value of Explicit ensures the pages of the FOMOD are displayed in the order which they are written in the script. If this attribute is not defined, the order will be alphabetical using the names from the installStep element. This is usually not desired behavior so including the attribute will allow mod authors to guide users through the installer in a specific manner.

<config xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://qconsulting.ca/fo3/ModConfig5.0.xsd">
   <moduleName>The STEP Installer</moduleName>
   <requiredInstallFiles>
      <folder source="00 Required" destination="" priority="1"/>
   </requiredInstallFiles>
   <installSteps order="Explicit">
   </installSteps>
</config>

FOMOD Pages

FOMODs can consist of one or multiple pages to suit to needs of the mod author. Each page is constructed by using various sets of elements which are explained below. There are more elements which can be include than listed below, however, these are considered advanced so they will be discussed later in the Advanced Scripting section of this guide.

installStep
This is the first element for any FOMOD page and tells the XML parser that a new page is starting. This element will contain all other child elements listed below between its opening and closing tags. There is only attribute within this element, name. The name attribute gives the page a name for the mod managers to display. Remember, if you didn't include the order="Explicit" attribute in the installSteps element above in the Header, then the FOMOD will list the pages in alphabetical order using the value placed within the name attribute here and on subsequent pages.
optionalFileGroups
This element houses the rest of the page elements between its opening and closing tags. Think of this element as a container for the group elements below.
group
The next element is the group element. This element will house the plugin elements for each group between its opening and closing tags. There can be one or multiple group elements for each page. Each group element has two available attributes: name and type. The name attribute assigns a name to the corresponding group. The type attribute assigns the type of selection each group is. The available types are:
SelectAny
This type displays checkboxes and allows users to select any of the listed options. If a group has no install options and is simply used for informational purposes, this type must be used. Use this type when all or none of the options from the group can be selected by the user.
SelectExactlyOne
This type displays radio buttons and allows users to select only one option from the listed options. Use this type when only one option should be selected from the group and at least one option is required to be selected.
SelectAtMostOne
This type displays radio buttons and allows users to select only one option from the listed options like SelectExactlyOne; however, it will add a None option for users to select if none of the options are desired. Use the type when only one option should be selected from a group, but also when none of the options are required.
SelectAtLeastOne
This type displays checkboxes and allows users to select any of the listed options like SelectAny; however, it's also similar to SelectExactlyOne in that at least one option must be selected. This type is not often used. Use it whenever a user must select at least one option from the group, but also has the option of selecting more than one or all options available.
SelectAll
This type displays checkboxes, but requires users to select all listed options and will automatically have these options selected. MO users will not be able to deselect these options and NMM users will receive a warning if they attempt to do so. This is the least used type and is typically only used in combination with conditions and flags, which is discussed in the Advanced Scripting section of this guide. Use this whenever all options in a group must be selected.
plugins
Like the optionalFileGroups element, the plugins element is mainly a container for the plugin elements. This element will house all the plugin elements between its opening and closing tags. It also has one attribute, order. This attribute does the same as it does in the installSteps element explained earlier in the Header section. When used, the order="Explicit" attribute will maintain the list of plugins in the order they are listed. If this attribute is omitted, the plugins within that group will be listed alphabetically.

Since the next element, plugin, is where most of the magic happens, this opening section will be ended here to allow a more in-depth look at what happens between the plugin tags.

Plugin Element

plugin
This is where the fun starts happening.