Difference between revisions of "Papyrus Compiler"

Jump to navigation Jump to search
484 bytes added ,  13:24, 6 December 2018
Changed page name, added to tooling category, added internal links, and some details.
imported>Qazaaq
m (Scrivener07 moved page Papyrus Compiler Reference to Papyrus Compiler: Simply the tool name)
imported>Qazaaq
(Changed page name, added to tooling category, added internal links, and some details.)
Line 1: Line 1:
== What is the compiler? ==
The [[Papyrus Compiler]] is a command line utility used to compile [[Script File]]s.
The compiler is a program that takes the script file you write (the .psc file) and converts it to a format that the game can understand (the .pex file). 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 program will take 'source' <code>*.psc</code> files and convert them into executable <code>*.pex</code> files, a format that Fallout 4 can understand.  
During the process it will check your scripts for a wide range of [[Papyrus Compiler Errors|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 <code>...\Steam\SteamApps\common\Fallout 4\Papyrus Compiler\PapyrusCompiler.exe</code>.


== Running the compiler ==
== Running the compiler ==
=== In the Creation Kit ===
=== In the Creation Kit ===
The easiest way to run the compiler is to have the Creation Kit do the compilation for you via the Papyrus Script Manager. Simply right-clicking on a script and selecting "Compile" will compile the script and show you any errors reported.
The easiest way to run the compiler is to have the [[Creation Kit]] do the compilation for you via the [[Papyrus Script Manager]].  
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):
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"
  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.
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 Kit ===
=== Outside the Creation Kit ===
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.
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.
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 project if you specify the .ppj extension, for more information, check out the page on [[Papyrus Projects|projects]]. Any command line arguments override any project settings.
You may also pass a [[Papyrus Project]] if you specify the <code>.ppj</code> extension, for more information, check out the page on [[Papyrus Projects|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):
The common command-line parameters are listed as follows. There are others, but most users will not need them:
  -import="<folders>"
  -import="<folders>"
  -output="<folder>"
  -output="<folder>"
Line 32: Line 42:
  -i="<folder 1>;<folder 2>"
  -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.
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.
Files in folders listed first override ones in folders listed after.
Line 40: Line 53:
  -o="<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.
This parameter specifies the output folder for the compiled files.  
You'll almost always want this to be your game's "Data/Scripts" folder.


==== Flags ====
==== Flags ====
Line 46: Line 60:
  -f="<file>"
  -f="<file>"


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


==== Optimize ====
==== Optimize ====
Line 52: Line 67:
  -op
  -op


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


==== Release ====
==== Release ====
Line 58: Line 74:
  -r
  -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.
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.


==== Final ====
==== Final ====
  -final
  -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.
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.


==== All ====
==== All ====
Line 69: Line 87:
  -a
  -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.
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.


==== Quiet ====
==== Quiet ====
Line 75: Line 95:
  -q
  -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.
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 Errors ==
== Common Errors ==
Line 81: Line 102:


== See Also ==
== See Also ==
*[[Script File]]
*[[Papyrus Projects]]
*[[Papyrus Projects]]
*[[Papyrus Compiler Errors]]
*[[Papyrus Compiler Errors]]
*[[:Category:Creation Kit|Creation Kit Category]]


[[Category: Scripting]]
 
[[Category: Papyrus]]
[[Category:Creation Kit]]
[[Category:Tooling]]
[[Category:Scripting]]
[[Category:Papyrus]]
Anonymous user

Navigation menu