Papyrus Compiler

Revision as of 15:30, 6 December 2018 by imported>Qazaaq
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The Papyrus Compiler is a command line utility used to compile Script Files. The program will take source *.psc files and convert them into executable *.pex files, a format that Fallout 4 can understand. During the process it will check your scripts for a wide range of errors, and report them to you. All Papyrus scripts must be compiled before they can be used in the game. The Creation Kit uses this utility to compile scripts inside the editor as well. This utility is included with the Creation Kit and can be found ...\Steam\SteamApps\common\Fallout 4\Papyrus Compiler\PapyrusCompiler.exe.

Running the compilerEdit

In the Creation KitEdit

The easiest way to run the compiler is to have the Creation Kit do the compilation for you via the Papyrus Manager Window. Simply right-clicking on a script and selecting "Compile" will compile the script and show you any errors reported.

The Creation Kit uses a project with the equivalent of the following command line to build scripts (see below):

PapyrusCompiler <file> -i="<scripts folder>" -o="Data\Scripts" -f="Institute_Papyrus_Flags.flg"

You can tell the Creation Kit to build in release or release final mode as well via the Creation Kit's preferences page. Release adds the "-r" and "-op" flags to the command, and release final uses the release flags plus the "-final" option.

Outside the Creation KitEdit

Power-users may want to execute the compiler via the command line, or via a batch file, or even through your favorite text editor. In order to do so, you'll want to run the PapyrusCompiler.exe inside the "Papyrus Compiler" folder, which can be found in the location where you installed the editor. Of course, you'll need to specify a series of command line arguments to tell it what to do. If you run the compiler without any command line parameters, or with erroneous ones, it will spit out a set of help text to remind you what they are.

The very first thing you pass to the compiler is the name of the script (or folder, if you're using the -all flag) to compile.

You may also pass a Papyrus Project if you specify the .ppj extension, for more information, check out the page on projects. Any command line arguments override any project settings.

The common command-line parameters are listed as follows. There are others, but most users will not need them:

-import="<folders>"
-output="<folder>"
-flags="<file>"
-optimize
-release
-final
-all
-quiet

ImportEdit

-import="<folder 1>;<folder 2>;<folder 3>"
-i="<folder 1>;<folder 2>"

This command line parameter specifies a list of folders that the compiler will look in for other scripts and the flag file. You'll want to at least point this at the folder that contains all the game's base scripts. Multiple folders are separated by semicolons. If compiling a project, these specify places to look for the project, but the project's own import folders will override this when searching for scripts.

Files in folders listed first override ones in folders listed after.

OutputEdit

-output="<folder>"
-o="<folder>"

This parameter specifies the output folder for the compiled files. You'll almost always want this to be your game's "Data/Scripts" folder.

FlagsEdit

-flags="<file>"
-f="<file>"

This parameter specifies the flag (.flg) file to use for processing flags in the scripts. You'll almost always want this to be "Institute_Papyrus_Flags.flg"

OptimizeEdit

-optimize
-op

This parameter tells the compiler to perform basic optimizations on the script. You will usually want this on for any script you release.

ReleaseEdit

-release
-r

This parameter tells the compiler to remove all debugOnly function calls from the script, optimizing it and reducing its size slightly depending on how many you use. You will usually want this on for any script you release.

FinalEdit

-final

This parameter tells the compiler to remove all betaOnly function calls from the script, optimizing it and reducing its size slightly (depending on how many you use). You will usually want this on for any script you release.

AllEdit

-all
-a

Compiles every single script in the specified folder. The folder path replaces the filename as the first argument to the compiler. This is usually faster then compiling each script in the folder independently, as the compiler can re-use data.

QuietEdit

-quiet
-q

Forces the compiler to be silent, only printing out any errors encountered. Usually used with the All flag to reduce the amount of spam sent to the output.

Common ErrorsEdit

Common errors emitted by the compiler are listed on another page

See AlsoEdit