Skip to content

Compilation

Scrivener07 edited this page Jun 23, 2019 · 10 revisions

The Papyrus Language extension provides features related to source code compilation.

Do you have a complicated build system, or something simpler? VS Code will accommodate in any case. There are many ways to compile Papyrus scripts with VS Code. Read more about the Papyrus Compiler.

Table of Contents

Using the Project Explorer

The Project Explorer for Papyrus provides compilation support.

Read more about the Project Explorer.

Using the VS Code Integrated Terminal

The VS Code Integrated Terminal provides a command line interface (CLI) inside the editor. The compiler may be executed using tasks in several ways.

CLI a File
PapyrusCompiler <psc> -i="<scripts folder>" -o="Data\Scripts" -f="TESV_Papyrus_Flags.flg"
CLI a Directory
PapyrusCompiler <folder> -i="<scripts folder>" -o="Data\Scripts" -f="TESV_Papyrus_Flags.flg"
CLI with Papyrus Project (Fallout 4)
PapyrusCompiler <ppj>"
  1. Copy the full file path string to a Papyrus Project intended for compilation.
  2. Open the VS Code Integrated Terminal and set the current working directory to the Papyrus Compiler folder.
  3. Execute the "PapyrusCompiler.exe" where the first argument is the file path of a Papyrus Project (*.ppj).
Execute
<Papyrus Compiler> PapyrusCompiler.exe "the\path\to\your\project.ppj"

Using VS Code Tasks

A VS Code Task is a special workspace file ...\MyWorkSpace\.vscode\tasks.json. A task may be used to execute the compiler, call a batch file, or any other process.

Compile Directory Task

For simple builds the compiler can be called directly with arguments from a task.

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Papyrus Compile Directory (Fallout 4)",
            "group": "build",
            "type": "process",
            "command": "${config:papyrus.fallout4.installPath}Papyrus Compiler\\PapyrusCompiler.exe",
            "options": {
                "cwd": "${config:papyrus.fallout4.installPath}"
            },
            "args": [
                {
                    "value": "${config:papyrus.fallout4.installPath}Data\\Scripts\\Source\\User",
                    "quoting": "strong"
                },
                {
                    "value": "-import=${config:papyrus.fallout4.installPath}Data\\Scripts\\Source\\User;${config:papyrus.fallout4.installPath}Data\\Scripts\\Source\\Base",
                    "quoting": "strong"
                },
                {
                    "value": "-output=${config:papyrus.fallout4.installPath}Data\\Scripts",
                    "quoting": "strong"
                },
                {
                    "value": "-flags=Institute_Papyrus_Flags.flg",
                    "quoting": "strong"
                },
                {
                    "value": "-all",
                    "quoting": "strong"
                }
            ],
            "problemMatcher": []
        }
    ]
}
Compile File Task

This is a VS Code Tasks example for calling a batch file with arguments.

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Papyrus Compile Custom (Skyrim SE)",
            "group": "build",
            "type": "shell",
            "command": "the\\path\\to\\your\\compile.bat",
            "args": [
                {
                    "value": "${config:papyrus.skyrimSpecialEdition.installPath}",
                    "quoting": "strong"
                },
                {
                    "value": "path\\to\\directory\\for\\compilation",
                    "quoting": "strong"
                }
            ],
            "problemMatcher": []
        }
    ]
}

See Also

Clone this wiki locally