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

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

The moduleName element holds the name of the module, which is placed between the opening and closing tags. This can be anything, but it's recommended to use the name of the mod which the FOMOD is being created for. This element is nested below the config' element; 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 SkyrimSE Guide</moduleName>
</config>

requiredInstallFiles

The requiredInstallFiles element's section is optional, meaning it does not need to be included within the ModuleConfig script. This element exists to install any required files without user intervention. These are normally files such as a ReadMe or files that the mod requires to function properly. The element only contains either a file element, a folder element, or a combination of both. For this Guide, it contains a single folder element:

<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="000 Required - Core Files" destination="" priority="0"/>
   </requiredInstallFiles>
</config>

File and Folder Elements

Within each file or folder elements are up to three attributes:

  • source
  • destination
  • priority

These attributes are always defined as attributeName="attributeValue"; the value is always within quotation marks.

Source

The source attribute defines the path to the file or folder being installed from the mod's folder structure. 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 "000 Required - Core Files" folder will be installed to the game's directory. When installing a single file, the path needs to be defined to the file's location within the folder structure and include the file name, itself. For example: source="00 Required\textures\terrain\tamriel\trees\tamrieltreelod.dds"

Destination

The destination attribute defines the destination of where the file or folder from the source attribute's value will be installed. When installing an entire folder, 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. When installing a specific file, unless that file will be installed within the Data directory itself, the destination should be the path to the folder where that file should be installed. See the example below:

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

The priority attribute defines the order in which files or folders from the entire script are installed. The lower the value, the lower the priority will be during file/folder installation. The starting value isn't important as long as the priorities are set properly. For example:

  • A file/folder with a priority value of 0 will be installed before any other files or folder
  • A file/folder with a priority value of 1 will overwrite any file/folder with a priority of 0, but before any other high values
  • A file/folder with a priority value of 2 will overwrite any file/folder with a priority of 1 or 0, but before any other high values
  • ...and so go and so on

installSteps

The "page container" element is: installSteps. This element is similar to the config element in that it contains all the FOMOD "pages" within its opening and closing tags. The installSteps element contains one attribute, order, and should be defined as below. The order attribute with a value of Explicit ensures the pages of the pages are displayed in the order they are written into the script. If this attribute is not defined, the order of the pages will be alphabetical. This is usually not desired behavior so including the attribute will allow users to be guided through the installer in a specific order.

<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. There are more elements other than the ones listed below; however, these are considered advanced and are discussed in the Advanced Scripting Reference.

installStep

The installStep' element is the initial element that defines a new page. This element is a container, nesting all other child elements within its opening and closing tags. There is only one attribute: name. The name attribute defines the page name for the mod manager GUI.

Info-Logo.png
NOTE:
Remember, if order="Explicit" attribute isn't defined in the installSteps element, then pages will be listed in alphabetical order using the value placed within these name attributes.
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.