Jump to content

Help with Notepad++ setup for scripts


Recommended Posts

First off, I have been thru the CK tutorial repeatedly and followed it to the letter. Have also searched through forums via Google looking for similar issues, and have found no clear answer.

 

I installed Notepad++, followed the CK to setup the batch command, using copy/paste so there were no typos. No matter what I put in the .bat file, or what directories I point to, when I run the batch to compile, it always points to the Bethesda C:\Projects\TESV\Build\PC folder.

 

My game is in the default folder. This is the line from the CK tutorial:

 

cd %2

"%~dp0PapyrusCompiler" %1 -f="TESV_Papyrus_Flags.flg" -i="%~dp0..\Data\Scripts\Source" -o="%~dp0..\Data\Scripts"

pause

 

 

This is one of many variations I've tried:

 

cd C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Papyrus Compiler

"C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Papyrus Compiler\PapyrusCompiler.exe" %1 -f="TESV_Papyrus_Flags.flg" -i="C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Scripts\Source" -o="C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\Scripts"
pause

I can run all that from the dos prompt (with compilation errors, I can deal with that) but I don't understand why running it from Notepad++ makes it look in the wrong directories?
Link to comment
Share on other sites

Since this the the Special Edition section I'll ask the obvious question. Did you literally copy this into the Notepad++ run command?

"C:\Program Files (x86)\Steam\steamapps\common\skyrim\Papyrus Compiler\ScriptCompile.bat" "$(FILE_NAME)" "$(CURRENT_DIRECTORY)"

If so the problem is probably that you're modifying the ScriptCompile.bat in your SSE folder and you've pointed Notepad++ to the original Skyrim compiler directory instead.

Link to comment
Share on other sites

  • 2 months later...

I'm just starting out with the CK and scripting and there isn't a lot on the web regarding setting up Notepad++ for Papyrus scripting in Skyrim Special Edition. Sure there's stuff for the same with regular Skyrim but I think these guides are missing some of the nuances that SE introduced.

 

I found this thread that talks about making sure the Script extraction during first run of the CK doesn't screw up the Scripts and Source folder structure. I also tried installing PapyrusPlusPlus (which is on the regular Skyrim Nexus), but after opening a few base game scripts I think it is only partially highlighting the Papyrus syntax. Next I think I'lll try to comb through the mess in the Notepad++ CK wiki article to see if that improves the situation.

 

Are there any other beginner guides for setting this all up for SE? Any thoughts about Notepad++ vs. Sublime? Any general recommendations would be welcome as well. Cheers!

Link to comment
Share on other sites

The only setup differences I can think of between LE and SE for Notepad++ is the different source folder. The code highlighting and section folding is handled by a language xml. It has nothing to do with the compiler support stuff.

For a compiler script I have my own custom one I wrote which can be found on my dropbox link here dm_NPPScriptCompile.zip. Inside is a readme file that explains the parameter usage. I would place the batch file in the "Papyrus Compiler" folder under the game folder, but in reality it can go anywhere you want. It supports Skyrim, Skyrim SE, and Fallout 4. See the readme in the zip. Using it with Notepad++ is pretty simple, you would set the execution to be something like this using NppExec (default plugin, press F6 to run stuff):

"I:\Games\Steam Library\SteamApps\common\Skyrim Special Edition\Papyrus Compiler\dm_NPPScriptCompile.bat" -skse "$(FILE_NAME)" "$(CURRENT_DIRECTORY)"


As demonstrated, I don't have my games installed in the Program Files folder structure. This will run the compiler, compiling the currently active file, saving the pex to the same folder. You can change the end parameter "$(CURRENT_DIRECTORY)" to change where it outputs the pex. I don't like compiling direct to the game folder so this works for me.

For the syntax highlighting I use a dark theme called Zenburn. The language xml I use is here dm_Zenburn_Papyrus.zip. To import it goto the Language menu and choose the Define Your Language option at the bottom. Click the import button and choose the xml. Then with any files specified as the Papyrus language they will be colored like this

AhZUEFB.png


If you further want function lists that gets a bit more complicated. I have an experimental setup though you have to manually inject xml code into the configuration file. The file is located at "%APPDATA%\Notepad++\functionList.xml" In the file find the line that has "<parsers>" (probably around line 45) then directly under it put this code. Note you should close Notepad++ before editing the file. So use another editor.


            <parser id="papyrus_function" displayName="Papyrus" commentExpr="(;/.*?/;)|(;.*?$)|(\{.*?\})">
                 <AclassRange
                    mainExpr="^[\t ]*((auto )?(state))[\t ]+[\w_]+"
                    openSymbole = "\!"
                    closeSymbole = "\^"
                    displayMode="node">
                    <className>
                        <nameExpr expr="[\w_]+"/>
                    </className>
                    <function
                        mainExpr="^(^[\t ]*([\w_\[\]]+[\t ]+)?(function|event)[\t ]+[\w_]+[\.\w_]+?[\t ]*\(.*?\))">
                       <functionName>
                            <funcNameExpr expr="(\w+[\t ]*\(.*?\))"/>
                        </functionName>
                    </function>
                </AclassRange>
                <function displayMode="node"
                    mainExpr="(^[\t ]*([\w_\[\]]+[\t ]+)?(function|event)[\t ]+[\w_]+[\.\w_]+?[\t ]*\(.*?\))|(^[\t ]*?(group|struct)[\t ]+\w+[\t ]*)|(^[\t ]*?(auto state|state)[\t ]+\w+[\t ]*)">
                    <functionName>
                        <nameExpr expr="([\w_]+[\t ]*\(.*?\))|((state|group|struct)[\t ]+[\w_]+)"/>
                    </functionName>
                    <className>
                        <nameExpr expr="([_A-Za-z][\w_]*\.)*[_A-Za-z][\w_]*\."/>
                        <nameExpr expr="([_A-Za-z][\w_]*\.)*[_A-Za-z][\w_]*"/>
                    </className>
                </function>
            </parser>

 


Then you can have stuff that looks like this

qAywd8z.png

 

Edited by BigAndFlabby
Link to comment
Share on other sites

Thanks for sharing the great (and detailed) info BigAndFlabby!

 

I haven't tried anything related to compiling yet, but I got everything to work EXCEPT the Autocomplete. I followed the CK wiki and still no luck, Autocomplete only shows options for entries already in the current file as opposed to all possible entries. I've doubled-checked to ensure that all locations that say "Papyrus" in either file names or file contents say exactly "Papyrus" and not "papyrus" (or a mix of the two), and Autocomplete is enabled within the settings.

 

Do you use Autocomplete with Papyrus for Notepad++, and if so would you mind going into more detail about your Autocomplete XML file as well as setup steps? Thanks!

Link to comment
Share on other sites

Thanks for sharing the great (and detailed) info BigAndFlabby!

 

I haven't tried anything related to compiling yet, but I got everything to work EXCEPT the Autocomplete. I followed the CK wiki and still no luck, Autocomplete only shows options for entries already in the current file as opposed to all possible entries. I've doubled-checked to ensure that all locations that say "Papyrus" in either file names or file contents say exactly "Papyrus" and not "papyrus" (or a mix of the two), and Autocomplete is enabled within the settings.

 

Do you use Autocomplete with Papyrus for Notepad++, and if so would you mind going into more detail about your Autocomplete XML file as well as setup steps? Thanks!

 

Heh actually I hadn't either until just now when I saw your post. I had put the auto completion xml in the wrong place (was in \Users\...\AppData\Roaming\Notepad++\Plugins\APIs). As stated on http://docs.notepad-plus-plus.org/index.php/Auto_Completion the xml must go in the Application's install folder. So mine is "C:\Program Files (x86)\notepad++\Plugins\APIs". You'll see other xml files in there. Put the papyrus.xml for the autocomplete there. Then relaunch Notepad++ and it should be working.

 

I haven't messed with adding in the new functions and stuff from Fallout 4 but upon a quick test it seems to have worked. I used the file linked from github on the wiki page https://www.creationkit.com/index.php?title=Papyrus_Autocomplete

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...