ModSync/For guide authors/Instruction files

Instruction files and guides

An instruction file is the part of a mod build that ModSync reads: the list of mods and the exact steps to install each one. Guide authors write it; players only load it.

What an instruction file is

A KOTOR mod build is usually a long written guide: install this mod, then that one, copy these files, delete those, pick this option. An instruction file is the same guide written so a program can follow it.

It lists every mod (a component) with its name, author, tier, category, description and download links, whether it is selected by default, what it depends on, and the instructions that install it. Each component has a unique ID, so two mods with the same name never get mixed up.

The file belongs to the build and is published with it. ModSync only reads it. Players never need to edit it.

Formats

FormatNotes
TOMLThe usual ModSync format, with one [[thisMod]] table per component. Keeps build-level metadata.
YAMLA metadata document followed by one document per component. Keeps build-level metadata.
JSONAn array of components.
XMLStructured XML guides.
MarkdownStructured instructions in fenced or comment blocks are read directly. A plain prose guide can be drafted into instructions for review (see below).

File extensions are not case sensitive, and an unknown extension is detected from the content. Use modsync convert to move a guide between formats.

A small example

This is examples/demo.toml from the source. The first component copies a texture into Override. The second depends on the first, and removes any .tpc that has a matching .tga.

[metadata]
title = "ModSync sample install"

[[thisMod]]
Guid = "sample-textures"
Name = "Sample textures"
Author = "ModSync"
Tier = "Essential"
Category = ["Textures"]
Description = "Copies sample.tga from the mod directory into Override. Use empty demo folders, not a real game install."
IsSelected = true

[[thisMod.Instructions]]
Action = "Copy"
Source = ["<<modDirectory>>/sample.tga"]
Destination = "<<kotorDirectory>>/Override"

[[thisMod]]
Guid = "sample-cleanup"
Name = "Remove conflicting textures"
Tier = "Essential"
Description = "Removes a TPC when a TGA with the same name exists."
IsSelected = true
Dependencies = ["sample-textures"]

[[thisMod.Instructions]]
Action = "DelDuplicate"
Source = [".tga", ".tpc"]
Destination = "<<kotorDirectory>>/Override"
Arguments = ".tpc"

Folders in instructions

Paths start from one of two placeholders, so the same file works on every computer:

  • <<modDirectory>> is the folder that holds the player's downloaded mod archives.
  • <<kotorDirectory>> (or <<gameDirectory>>) is the player's game folder.

Write placeholders exactly as shown, including capital letters. Sources may use wildcards. Anything that would reach outside those two folders is refused.

Instruction actions

ActionWhat it does
ExtractUnpacks a ZIP, 7z, RAR, TAR, GZip or 7z self-extracting archive into a folder named after the archive, next to it.
Copy, MoveCopy or move matching files into the destination folder.
RenameRenames a file within its own folder.
DeleteDeletes matching files.
DelDuplicateRemoves a file of one type when a file of another compatible type has the same name, such as an old .tpc next to a new .tga.
CleanListRemoves files listed in a comma-separated clean list.
PatcherRuns a TSLPatcher-style patch. Uses the built-in OdyPatcher library by default, or an OdyPatcher, HoloPatcher or KPatcher program you choose. Needs the player's permission.
Execute, RunRuns a local program directly, without a shell. Needs the player's permission.
ChooseApplies the options the player selected, in the order the options are declared.

An unknown action name fails validation instead of being skipped. Every supported action and field is listed in COMPATIBILITY.md.

Order, dependencies and options

  • Dependencies names the components that must be installed first. InstallBefore and InstallAfter adjust the order further. A reference to a missing component, or a loop, fails validation.
  • Restrictions mark components that cannot be installed together.
  • Options let the player pick variants of a mod. An option is referred to by its ID.
  • IsSelected sets the default choice. Tier and Category drive the bulk selection buttons in the desktop.
  • Widescreen-only components install in their own phase after the main build.

Drafting from a Markdown guide

If your build exists only as a prose Markdown guide, ModSync can draft instructions from it for you to check. Drafts stay blocked until each one has been reviewed.

modsync convert guide.md draft.json --parse-directions
modsync convert draft.json reviewed.toml --review-draft <component-guid>

When the archives are already downloaded, --review-verified-drafts with --source-path clears review only for drafts that a fresh replay of the archive reproduces exactly. For components with no instructions at all, --auto-generate-local infers extraction, file moves, folder choices and patcher steps from the archives and prints a report per component.

modsync convert guide.toml generated.toml --auto-generate-local --source-path /path/to/mods

A draft is a starting point. Check every generated action and path before you accept it, then validate the guide. A generated draft is not proof that the prose was understood correctly.

Players can also install straight from a prose guide with install --direct-markdown. It installs in source order, skips 4GB Patcher and widescreen-only entries, and stops before changing the game until every selected draft has been reviewed.

Other tools for guide authors

Check without installing
modsync validate runs the full check against real folders, and modsync conflicts lists every game file that more than one component writes, in install order.
Merge two guides
modsync merge EXISTING INCOMING OUTPUT matches components by ID, then by name and author.
See which files a download page offers
modsync download-plan shows which filenames a component would use from a host's list, without downloading.
Share an exact archive by BitTorrent
modsync torrent-seed prints a magnet link, SHA-256 and torrent info for the guide to record. Players fetch it with modsync torrent-download. See Command line.
Edit in the desktop
The desktop includes a guide editor for component details, dependencies and restrictions, and for adding, removing and reordering components and instructions. It does not edit options yet. A separate Qt-based authoring app is in development in desktop/qt.