Scripting: Compiling In Notepad++

///Scripting: Compiling In Notepad++

Compiling Scripts in Notepad++

content by OpusGlass

Writing Papyrus scripts in a dedicated code editor can be much easier than writing it in the CK for a variety of reasons. Here’s how you can set up a Papyrus environment in Notepad++.

This assumes you’ve already extracted your Scripts.rar archive. (Otherwise, you can’t compile even in CK!)

If you’re on Special Edition, you’ll need slightly modified versions of the scripts, which I’ve listed at the bottom.

Compiling

Part A. Edit your Batch file

1) Make a copy of ScriptCompile.bat in your “…\Skyrim\Papyrus Compiler” folder. (Just select it, hit Ctrl+C, then Ctrl+V.)

step1-1.png.e2229c0cd485a31efb7a46d641686f50.png

2) Open ScriptCompile.bat in a text editor such as Notepad. (Right click the file, Edit, and if it asks you to pick a program, find Notepad.)

step1-2.thumb.png.13701c964765164ba80b67e01d142951.png

3) Replace the text of the file with this:

“%~dp0PapyrusCompiler” %1 -f=”TESV_Papyrus_Flags.flg” -i=%2;%3;%4;%5;%6 -o=%2\..

pause

It needs to be exact, so copy and paste.

step1-3.thumb.png.9653ea18fedecbcd337dcb924cd026ee.png

4) Save (Ctrl+S)

Part B. Create a Notepad++ keboard shortcut.

1) Copy and paste the following command into any text editor:

“{Skyrim path}\Papyrus Compiler\ScriptCompile.bat” “$(FILE_NAME)” “$(CURRENT_DIRECTORY)” “{Skyrim path}\Data\Scripts\Source”

2) Replace the two places where I’ve written {Skyrim path} with, you guessed it, your Skyrim path. Don’t keep the {}.

step2-0.thumb.png.c11a60789d4994a9689e040fca756a4b.png

3) OPTIONAL: If you have any other source paths you need, for example if you have PapyrusUtils or SkyUI installed in a separate location and you need those functions in your scripts, you can add up to 3 additional paths at the end of that command.

step2-0b.thumb.png.bb4529ca774cfb82bab3b041190685c9.png

4) In Notepad++, go to Run->Run. Paste in your modified command. Click “Save…”

step2-1.png.d474274ad86064208f4508ebef3e21a9.png

step2-2.png.a3edf660e2a39dc255ae2da8c80b08bf.png

5) Name it “Papyrus” then select a keyboard shortcut. I use Alt+P, so I check the box for Alt and then use the dropdown menu to find P.

step2-3.png.1cf510decc21883b79837321cacebcc7.png

6) Test it out! Open a Papyrus file and hit Alt+P. You should get a window with confirmation that it compiled successfully. The window disappears as soon as you hit a key.

step2-4.thumb.png.a80cda0b5a52d886bb884dd3c8bdd0d5.png

Syntax Highlighting

1) Download this file: papyrus_definitions_skse.xml

Credit goes to Cdcooley for this file. I got it from here: https://www.creationkit.com/index.php?title=User:Cdcooley/Notepad%2B%2B_Papyrus_Syntax_Highlighting

In addition to general syntax highlighting for Papyrus, it highlights any SKSE functions with a different color than vanilla functions, making it easy to tell if a script has a dependency.

You can find other custom Papyrus definitions here: https://www.creationkit.com/index.php?title=Notepad%2B%2B_Setup#Setting_up_Papyrus_Language_Definitions

2) In Notepad++, go to “Languages->Define your language…”

step1.thumb.png.21d5af0ea2c5badd2935b3f18840368f.png

3) Then click Import and find the file you downloaded.

step2.png.7074e60ee54eb70a52af2465a632114a.png

4) Then click Save As and type Papyrus.

step3.png.b3f30d53393c7d31ac770c4593dc39f0.png

5) Then, while you have a .PSC file open, go to Languages and select Papyrus.

step4.thumb.png.98eb0ec02762ce4a2f5ff480473b22e0.png

Everything should now be highlighted by syntax, and it will remember these settings whenever you open a PSC file!

===================================================

ON SPECIAL EDITION:

You must use these modified versions of the commands, since SE’s Source files are in a different location.

ScriptCompile.bat:

“%~dp0PapyrusCompiler” %1 -f=”TESV_Papyrus_Flags.flg” -i=%2;%3;%4;%5;%6 -o=%2\..\..\Scripts

pause

Notepad++ command:

“{Skyrim SE path}\Papyrus Compiler\ScriptCompile.bat” “$(FILE_NAME)” “$(CURRENT_DIRECTORY)” “{Skyrim SE path}\Data\Source\Scripts”

Again, replace {Skyrim SE path} with your path.


Learn more, join our community!




Arcane University (also for non-members!)



Welcome to the Arcane University! We are a collaborative effort of Beyond Skyrim aiming to help people learn the various aspects that play into mod creation, like scripting, level design or 3d modelling to just name the major ones. If you are interested in learning one of these or just want to help out others achieve their goal, feel free to join us on our Discord server and begin your journey. Previous knowledge is not required, only that you are willing and eager to learn. Below you can find some work that students of the Arcane University made during their time with us. By honing your skills you can eventually graduate, those students may choose to work on one of the various Beyond Skyrim teams or the Atronach Forge, our cross-province content creation hub. So it is a good chance to get involved with the project and learn a few handy things along the way. Hope to see you soon!




By | 2018-09-13T15:19:54+00:00 August 6th, 2018|Sctripting, Tutorials|0 Comments

About the Author: