Abstract
Osiris formatter.
A command-line tool (.exe file) that takes Osiris files and formats them to be more readable and searchable, using my own best practices for Osiris formatting.
**This is not a validator. It will attempt to format your file regardless of whether the Osiris syntax is valid or not.
Helps with readability and in-file text searches (since the results are per line, and the line has more context).
Install
- Download (or use git mirror).
- Unpack.
- Place in a convenient location (same location for both files).
Usage
Option #1: (simple) Just drag Osiris files onto it.
You can drag multiple files, but not folders. All files will be assumed to be Osiris files.
Option #2: (advanced) Write a batch file that calls it.
(It’s a normal command-prompt executable)
⚠️ By default, the files will not be copied. They will be edited in place, and a backup will be created. This can be controlled via the INI. Just double-click the file to generate the default INI.
Note that Osiris files use the .txt extension and are located in
...\Data\Mods\[mod or module name]\Story\RawFiles\Goals
Game modules are: Shared, SharedDev, Gustav, and GustavDev.
You may need to use LSLib to unpack game pack files first.
Features
- Formats all standard story sections: INITSECTION, KBSECTION, EXITSECTION.
- Cleaner KB structure: consistent IF/PROC/QRY blocks, AND grouping, THEN separation, and predictable semicolons.
- ****Newlines inside argument lists: normalizes wrapped argument lists, keeping line breaks aligned under the opening parenthesis where needed.
- INIT/EXIT action readability: auto-aligns arguments across consecutive calls of the same action (pads columns, then inserts a blank line when the action name changes).
- Boolean normalization: “no literal 0” rule for boolean-flag queries (read the advanced section for more on that).
- Safer output controls: auto-creates osiris_formatter.ini, supports in-place or mirror output, and can keep .bak backups (default on).
- Batch-friendly: pass multiple files in one run (drag-and-drop or a .bat).
Limitations
- Does not validate logic.
- Assumes file is Osiris-like text.
- No GUI (yet).
Advanced
About Boolean normalization and bool_queries.csv
Some Osiris-style “boolean flag” calls are effectively true/false switches. But instead of just returning FALSE, they return an [out] argument.
This is useful for when you need the result in a variable... but using it with a '0' instead of a NOT damage readability.
So, if an argument is a hardcoded '0', it is rewritten to '1' and the line’s NOT is flipped.
This rule is data-driven through bool_queries.csv, as sourced from Baldur's Gate 3 Modding Wiki.
bool_queries.csv format
- name - function/query name.
- arg_count - exact argument count to match (useful in case of overloaded functions).
- arg_pos - a 0-based argument position (negative allowed, -1 = last argument).
bool_queries.csv contents example (the header line and 1 data line)
name,arg_count,arg_pos
DB_StoryReloaded,1,0
If the CSV is missing, the formatter simply does not apply the rule.
来源与文件
文件说明
A command-line tool that formats Osiris files more nicely.
前往 N 网打开所选文件。安装与下载要求以原作者及平台说明为准。
<!-- aoe-mods-source:nexusmods:baldursgate3:20931 -->