Skip to content
unforbidable edited this page Oct 9, 2015 · 18 revisions

Rules are stored in XML files called rule files. Multiple rule files may be associated with a plugin and multiple rules may be stored in a single rule file. The order in which rules are run depends on the plugin load order, file name and position in the rule file.

The tool will look for rule files using the following path and pattern:

{DataFolder}/Patcher/rules/{RuleSet}/{plugin.ext}/*.rules

By default, the tool will used the parent folder where its run from as as the Data Folder and rule set named default will be used as the rule set to run, but another data folder and rule set name may be specified via command line options. Note that only folders named after active plugins will be run.

Each rule may contain the following properties:

  • name represents the name of the rule. Giving rules unique names helps to identify a rule during troubleshooting.

  • description represents a long description of the rule which is not used by the tool in any way.

  • from informs the engine which kind of forms will be queried, e.g. GLOB, ARMO, ALCH. When from property is not provided the rule will run only once, which is handy for creating new forms from scratch (not by making copies of existing forms). Note that when FROM property is not provided properties where and update properties are ignored, and select and each insert is performed exactly once.

  • where specifies the criteria on which forms are queried, e.g. Source.HasKeyword("ArmorLight"). When where property is not provided the rule will run on all forms of type specified by the from property.

  • select makes no actual change and can be used for debugging or to tag a referenced form for further processing.

  • update overrides an existing form or edits the form if it has been already overridden during an update operation of a previous rule.

  • insert creates a new form either based on an existing form or entirely form scratch. The kind of the new form has to be specified as well. A rule may contain any number of insert properties.

The value of where, select, update and insert is an actual C# code that is compiled into methods.

The following graph shows every possible way a rule can be processed. The path depends on which properties are defined for the rule: Rule Processing

Clone this wiki locally