Jump to content

FO4 Compiling within Notepad++ using Capirca


rainrtw

Recommended Posts

This is here because when I was looking for this info, I found very little and most of what I saw was for Skyrim which is a different compiler. So here is hoping the next modder trying to set this up has an easier time.

If this has been said elsewhere, that just didn't show up in searches, then I will link to that as well. But again I couldn't find anything more recent then the 5 lines or so on the CK wiki about setting up Npp to use the SKyrim compiler, and that doesn't seem useful this time around.

This was made possible by Wenderer showing how to actually use the right compiler lol.



Personally I begin modding any Bethesda game by copying the folder structure of the game off to larger storage drive for testing and building stuff without accidentally screwing up my main install folder. Then I unpack all the BSA's there to so I have a good vanilla resource base to work with, without seeing a bunch of stuff added by other mods. I want to work off what Bethesda made, not other modders. I have several nice 2tb drives, so space isn't an issue for me. I know its easier for most people to edit stuff directly in their install folder, as you don't have to keep copying stuff to there from you WIP folders to test... but I tend to have a complicated, heavily modded install and many WIP projects going at once so keeping all WIP on a separate drive suits me.
Just letting you know you WILL have to change the paths to the ones more suited to your setup, but that should be easy enough to do. Just open up a file browser, navigate to where you want that item to point then look at the address bar area.



First you need Caprica http://www.nexusmods.com/fallout4/mods/7380/?
And you need to take note of where you unpack the 7z file too. For me that is,
"E:\Games\Fallout 4 Mods\Tools\Caprica" but obviously yours will be different... especially if you don't have multiple Drives :tongue:
Still you need to note down the Path to your Caprica, when you find some place you will not be moving it again. And remember that path must be the one that points to the Caprica.exe file, not just where the 7z is or whatever.



You will need all the scripts from the game extract somewhere. You can either do that with B.A.E. - Bethesda Archive Extractor, http://www.nexusmods.com/fallout4/mods/78/?
Like I did, or use the library included with PexInspector, http://www.nexusmods.com/fallout4/mods/7360/?
Now I have no idea how to properly use the PEXInspector so don't ask me, but the library with it is a quick source for the game scripts if you don't wanna bother extracting them, though that is fairly fast too.

Anyway you do it, you need a directory with all the game scripts in it for Caprica to compile for you. So find a place you will extract and leave Caprica and this Source folder. In my case it looks like,
"E:\Games\Fallout 4 Mods\Tools\Caprica\SourcePEX"
But yours will likely be different. Whatever folder you pick that folder must have all the game's scripts in .pex format.



At this point we can make a little .bat file to compile .psc scripts you drag onto it.
So make a new text file named Caprica.bat
If you have that evil windows feature, Hide extensions for known formats, on then you may have to disable it in Folder Options. Hit ALT in a File browser window then Tools->Folder Options, Uncheck hide extensions, Apply, then Apply to all folders. Otherwise your bat file may actually be named Caprica.bat.txt
Right click your bat file and EDIT it.
Now your paths will of course look different but mine looks like this:

E:
CD\Games\Fallout 4 Mods\Tools\Caprica
Caprica %1 -i"E:\Games\Fallout 4 Mods\Tools\Caprica\SourcePEX" -o"E:\Games\Fallout 4 Mods\Working\Data\Scripts" --champollion-compat yes --allow-compiler-identifiers

You may not need to break it up to 3 lines but I like it to be nice and clear, and its more like the good old DOS Days.
First line is the Drive Caprica is on, for most that is C:
Second Line is change directory or CD\PathToYourCapricaExeHere
Third line is Caprica(name of the exe)
%1(this means insert the file name you drag and dropped here)
-i"Full path to your Directory Containing All Vanilla Scrips in .pex format" (Thanks to Wenderer... as I was too stupid to figure this bit out on my own.)
-o"Full Path to the Directory you want compiled .pex output to go." (can just omit this part if you want the .pex to appear right in the same folder as your .psc source.)
--champollion-compat yes --allow-compiler-identifiers (Additional flags to allow compatibility with scripts decompiled by Champollion, as suggested by johndoebowler on NexusMods)

Save that, and you should be able to drag viable .psc files onto it and get a .pex version in the output folder... assuming your code was right and your file can compile.
I should also note you can use paths relative the exe also, but I never got them to work on my machine so went with full paths.
Now you can copy that bat into any Directory you want, for an easy drag and drop compile option. Or Edit the -o"path" section out of the .bat so that it outputs in the same folder, for scripting in WIP type folder setups etc.



This part is adapted from and is all thanks to, this guide http://windowsbro.blogspot.com/2012/10/compile-with-notepad-any-language.html

Now you need Notepad++ https://notepad-plus-plus.org/
Install Notepad++
If it asks you about DspellCheck say No to keep it active, unless you're on Windows 10.
DspellCheck can cause a crass on Windows 10 so those users may want to disable spell check.
Congrats to you folks still using Win7, and disabling the nagware updates MS tried to shove down your throat to annoy you about their newest unstable toy.

 

Now you need to enable the NppExec plugin to run your compiler.

Plugins->Show Plugin Manager
Available-> Toggle NppExec-> Install-> yes install anyway.
It may ask to restart Notepad++ to activate it, say yes.

Now we need to tell the plugin how to compile your script so go to,
Plugins-> NppExec-> Execute
Here you can stretch that input box to be much larger, which you may want to do, since the lines we're adding can get a bit long.
The input here is going to look a whole lot like you .bat file did. Basically the biggest difference is that your starting with npp_save and will be replacing the %1 with "$(FULL_CURRENT_PATH)"
On my setup it looks like,

npp_save
E:\Games\Fallout 4 Mods\Tools\Caprica\Caprica "$(FULL_CURRENT_PATH)" -i"E:\Games\Fallout 4 Mods\Tools\Caprica\SourcePEX" -o"E:\Games\Fallout 4 Mods\Working\Data\Scripts" --champollion-compat yes --allow-compiler-identifiers

npp_save (Tells Notepad++ to save the file first, as the compiler runs on the saved .psc file not the text open in your current window.)
E:\Games\Fallout 4 Mods\Tools\Caprica\Caprica (the path where you unpacked Caprica too)
"$(FULL_CURRENT_PATH)" (passes the path and name of the open file)
-i"E:\Games\Fallout 4 Mods\Tools\Caprica\SourcePEX" (Again this points to where ever you unpacked all scripts of the game in .pex format.
-o"E:\Games\Fallout 4 Mods\Working\Data\Scripts" (where you want the compiled script saved to)
--champollion-compat yes --allow-compiler-identifiers (Additional flags to allow compatibility with scripts decompiled by Champollion, as suggested by johndoebowler on NexusMods)

You can and should test this if you have a .psc file open. Run it and check the output folder or look at the Console window for clues to fix any bad directories you may have entered. Then SAVE. That is Save the little NppExec script in the window and name it something like FO4 Compiler or whatever suits your fancy.



From this point on you can and may just want to see the original guide since it has pictures.
http://windowsbro.blogspot.com/2012/10/compile-with-notepad-any-language.html

Go to about 40% down the page to the line,

Now, we want a compile button shortcut, don't we?
(Summarized here for those who don't wanna read)
Plugins-> NppExec-> Advanced options
Associated Scripts, select yours then hit add modify.
Close window and restart Notepad++
Settings-> Shortcut mapper-> Scroll Way down looking for the name you gave the NppExec script earlier.
Personally I rebind Search Results window to CTRL+SHIFT+F7 so I can use F7 for compile.
Remember to make sure whatever Key Bind you choose isn't used by another function already.



(This part isn't strictly needed, but some may want it.)

I almost prefer using full paths for the sake of clarity, but some may prefer relative paths, so then can just type Caprica from anywhere to run it.
If you want to set up a system path so you can run Caprica more easily with relative paths etc, you can scroll back up that page to the system variable part, also summarized below for TL;DR
StartMenu, right click Computer-> Properties
Advanced System Settings
Advanced-> Environmental Variables
Bottom Section, System Variables-> Scroll down till you find the variable named Path
Select that and EDIT
Now you want to hit End key or otherwise scroll to the end of that line... it can be pretty long depending on what you have installed.
at the very end of the line you add a semicolon ;
then the path the leads to Caprica, in my case the PATH variable now looks like,
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;E:\Games\Fallout 4 Mods\Tools\Caprica



When it comes to actually attaching your script to something in FO4Edit I still refer to this post for building the VMAD data.

I have been told there are other tools for copying and building the VMAD but personally I'd rather build it myself, so I know exactly how it works.

 

 

 

 

 

Just stating what helped me set this up. I hope, but cannot guarantee, it will work for you as well.

Edited by rainrtw
Link to comment
Share on other sites

  • 5 weeks later...

For the life of me, I cannot get Caprica to work. I'm running Win8.1, if it matters. For testing purposes I made a simple comment block script that contains the following:

;/ This is a TEST
/;

Dragging-and-dropping to Caprica directly does nothing except flash the Caprica command window, and every time I try to compile through NPP I get the following:

NPP_SAVE: D:\STORAGE\Downloads\Caprica\Source\TEST.psc
D:\STORAGE\Downloads\Caprica "D:\STORAGE\Downloads\Caprica\Source\TEST.psc" -i"D:\STORAGE\Downloads\BethesdaArchiveExtractor\Extracted\Scripts" -o"D:\STORAGE\Downloads\Caprica\Scripts" --champollion-compat yes --allow-compiler-identifiers
CreateProcess() failed with error code 5:
Access is denied.

Here are the contents of the Caprica bat file:

D:
CD\STORAGE\Downloads\Caprica
Caprica %1 -i"D:\STORAGE\Downloads\BethesdaArchiveExtractor\Extracted\Scripts" -o"D:\STORAGE\Downloads\Caprica\Scripts" --champollion-compat yes --allow-compiler-identifiers

Here are the contents of the NPPExec script:

npp_save
D:\STORAGE\Downloads\Caprica "$(FULL_CURRENT_PATH)" -i"D:\STORAGE\Downloads\BethesdaArchiveExtractor\Extracted\Scripts" -o"D:\STORAGE\Downloads\Caprica\Scripts" --champollion-compat yes --allow-compiler-identifiers
Edited by digitaltrucker
Link to comment
Share on other sites

Oh yes, I have that installed. I got a response from Orvid that basically says I don't have a complete command instruction (it points to the folder and not the exe....I need one more step in there. The NPPExec script should have read as follows:

npp_save
D:\STORAGE\Downloads\Caprica\Caprica.exe "$(FULL_CURRENT_PATH)" -i"D:\STORAGE\Downloads\BethesdaArchiveExtractor\Extracted\Scripts" -o"D:\STORAGE\Downloads\Caprica\Scripts" --champollion-compat yes --allow-compiler-identifiers

Naturally, I now have a new problem, attempting to compile now gives me this output:

NPP_SAVE: D:\STORAGE\Downloads\Caprica\Source\TEST.psc
D:\STORAGE\Downloads\Caprica\Caprica.exe "D:\STORAGE\Downloads\Caprica\Source\TEST.psc" -i"D:\STORAGE\Downloads\BethesdaArchiveExtractor\Extracted\Scripts" -o"D:\STORAGE\Downloads\Caprica\Scripts" --champollion-compat yes --allow-compiler-identifiers
Process started >>>
unrecognised option '"import'
<<< Process finished. (Exit code -1)
================ READY ================
Edited by digitaltrucker
Link to comment
Share on other sites

Holy crap Batman, wtf is this?

 

Will scripting impact what I want to do with graphics and animations? [Edit] uh oh, I think animations require scripting... I don't want to make a new vault with hooded cats for like a year...which would involve quests and stuff.

Edited by jeffglobal
Link to comment
Share on other sites

  • Recently Browsing   0 members

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