JavaScript parser for compiled Papyrus script files.
Based off of UESP - Compiled Script File Format.
Built using ffp.
npm i matortheeternal/pex-parser --save
let {PexFile} = require('pex-parser');
let script = new PexFile('./path/to/script.pex');
script.parse();
// you can read things and make changes here
script.filePath = './path/to/copy.pex';
script.write();
The header of the script file. Includes the following properties:
magic
- Magic number used to recognize PEX files. Should be0xFA57C0D3
.majorVersion
- Major version of the papyrus compiler used to compile the script.minorVersion
- Minor version of the papyrus compiler used to compile the script.gameId
- ID of the game the script was compiled for.1
is Skyrim.compilationTime
- The date and time when the script was compiled.sourceFileName
- The name of the source file which was compiled.username
- The Windows username of the user who compiled the script.machinename
- The Windows machine name of the computer which compiled the script.
Array of strings. Other fields will refer to strings in this table by index.
Debug information for the script. Includes the following properties:
hasDebugInfo
- 1 if the script has debug info, 0 if it doesn't.modificationTime
- The date and time when the debug information was added to the script (?)functions
- array of DebugFunction entries.
Array of UserFlag entries for the script.
Array of compiled script Objects.