Fallout 4
0 of 0

File information

Last updated

Original upload

Created by

JonathanOstrus

Uploaded by

JonathanOstrus

Virus scan

Safe to use

Tags for this mod

About this mod

Patch to add the ability to compile Papyrus scripts with arrays, var types, and structs inside structs.
Removes your computer name and logged in username from the compiled scripts, strips full path info from embedded filename.
Optional memory cache and thread limiting parameters to enhance compile speeds for large projects.

Permissions and credits
Changelogs
Donations
The why?

This is a simple set of files to patch the Papyrus Compiler for Fallout 4. It always annoyed me that with its robustness Bethesda intentionally disallowed using arrays within structs and structs within structs. I've also made this a "NoDox" edition which also removes your computer and username from the compiled output along with stripping the extraneous path from the source filename. I'm not sure why anyone would want that data in there, but I left the option to use either one.

Starting with v1.40 there are changes that now require patching the PapyrusCompiler.exe and the PCompile.dll. You need .NET 4.0 (which most anyone should have by now) and the included .config file is also necessary or you will get a .NET error when it tries to run and nothing will happen.

v1.40 adds some additional features to the compiler exe
  • Added timing metrics on the output and more verbose information for when it's compiling multiple files at a time. Compile start time, end time, and elapsed time.
  • Added command line argument -threads=n (where n is a number ie 5) to limit the number of threads the compiler will spawn for compiling. In edge cases the vanilla compiler exe will cause an out of memory error with complex scripts. There is a sister setting for ppj files see below example.
  • Added command line argument  -enablecache argument and ppj setting for an in memory cache which dramatically speeds up compiles when doing a whole folder or using a ppj for multiple file compiles. If your project recompile takes more than 2 minutes this will probably help.
  • AnyCPU mode instead of 32bit limited to alleviate an edge case out of memory issue with compelx scripts.

Cache usage warning. It is a memory hog.
If you have limited memory (8gb or less) use the threads option to limit to 1. It will still be faster than not using the cache. In my testing the sweet spot for memory usage vs speed benefit was 4 threads. More threads did not speed it up significantly. As a sample metric, on my test system the original BGS compiler took over 3 hours to compile the whole Fallout 4 Base tree (7800 files). With the cache set to 1 thread it was about 5 minutes, and cache 4 threads was about 4 minutes.

Sample ppj header
<PapyrusProject
    xmlns="PapyrusProject.xsd"
    Flags="Institute_Papyrus_Flags.flg"
    Output="j:\wip\papyrus_output"
    Asm="Discard"
    Cache="true"
    Threads="4"
>

So with this patch you can do silliness like this.

Struct SomeStruct1
    int[] SomeIntArray
    string[] SomeStringArray
EndStruct
Struct SomeStruct2
    SomeStruct1 AnotherStruct
    SomeStruct1[] ArrayOfAnotherStruct
    int SomeNormalInt
EndStruct

If you don't understand the awesomeness of what this means, then this is not for you. The compiled output of the script will run on a normal user's game and they do not need anything from this patch.

I give no warranty of any kind as to the safety of using this patch or the subsequently generated file. In limited testing it has not shown to have any obvious issues. With this said, always keep a backup of any important files.

The How?

Please read the README.txt included in the archive for detailed instructions.