Jump to content
  • entries
  • comments
  • views

Compiling Scripts - Mod Organiser / Creation Kit / Sublime Text 3




This post has been revised 2016-02-05 to be less [slightly] angsty since I have slept since the original posting of 2014-12-03.



Problems this post should help you fix.

  • Problem: Sublime Text 3 cannot be used with MO.

  • Solution: Yes, it can work.

  • Problem: Compiling scripts with Sublime Text causes .pex files to go into the OVERWRITE directory instead of the directory the script came from. This means you have to move shit back into its mod folder manually every time you compile, which can be quite often while greenfielding.

  • Solution: Scripts can be copied into their specific mod folder automatically for you after compiling.





Below is the original post, somewhat revised but mostly original.



It is almost 6am, I have spent all day dicking with MO, I am hungry, tired, and pissed off. This has been a major pain in the ass. Using MO you cannot right click > compile any more, and the author of Mod Organiser seems to have no plans to fix it has made a thing to fix it, but it isn't really working well. The resulting output still ends up in your overwrite directory instead of where I want it to be (with the mod it came from). Last thing I want to do is add another series of clicks and drags every time I build (which can be like 20 times an hour).
Something about 32-bit 64-bit and not building a 64bit MO. I don't know. I don't care anymore. Here is the bullshit I had to go through to get to modding again with MO.


The current SublimePapyrus only works right with Sublime 2, and I want to use 3.


Get this shit.

  • Mod Organiser.
  • Sublime Text 3 - 32 BIT VERSION. 64BIT VERSION WONT WORK.
  • Get my hacked PapyrusCompiler.exe



This is what I did to it:



This is what I did to it: corflags.exe papyruscompiler.exe /force /32bitreq+
This tells windows to run this little shit in 32bit mode I guess. If you don't do this, PapyrusCompiler can't see the magic MO clusterfuck. corflags.exe comes in the Windows SDK and explaining how to install that, find it, find the right copy of the 10 corflags.exe it comes with, and use it, was a giant ass NOPE.



Do this shit.


1) Install MO. Get your game working. Get your saves loading. All that crap. This is the part that took me all day honestly.


2) Find your Papyrus Compiler directory in your Skyrim directory, make a backup copy of your PapyrusCompiler.exe and then put mine in that folder replacing the old one.


3a) Close all instances of ST3.


3b) Add sublime text as an executable to MO.


4) Launch Sublime through MO.


5) Sublime Text > Tools > Build Systems > New Build System. It will open a new file. Paste this crap into it.

{	"shell":true,	"cmd": [		"%YOUR-SKYRIM-PATH%\\Papyrus Compiler\\PapyrusCompiler.exe",		"${file}",		"-f=%YOUR-SKYRIM-PATH%\\Data\\scripts\\Source\\TESV_Papyrus_Flags.flg",		"-i=%YOUR-SKYRIM-PATH%\\Data\\scripts",		"-o=%HOME%",		"-asmonly",		"&&",		"chdir","%HOME%","&&",		"%YOUR-SKYRIM-PATH%\\Papyrus Compiler\\PapyrusAssembler.exe",		"${file_base_name}",		"&&",		"del","${file_base_name}.pas","&&",		"move","${file_base_name}.pex","${file_path/Source//i}"	]}

Figuring out this lovely chain of retardedness has been the last 5 hours of my life. The spoiler contains why.


If you let PapyrusCompiler.exe run as normal, your pex file ends up in the MO Override directory and not your output directory. I have no fucking clue why BECAUSE THE GOD DAMN PAS FILE STAYS WHERE IT IS SUPPOSE TO BE. So here I tell it to dump it to a directory far away from MO's magic bullshit, run PapyrusAssembler.exe on it manually, then move that pex file into where we actually wanted the damn thing.



5) See the %YOUR-SKYRIM-PATH%? Delete all of them and put in your path to Skyrim. It appears in that code 4 times, so guess how many places you have to edit it. For example, I would replace it with C:\\Games\\Steam\\steamapps\\common\\Skyrim. See how I double backslashed every directory. DO THAT.




Your Skyrim has probably has Program Files (x86) in it if you let Steam default itself.


6) Save that file as MyPapyrus.sublime-build in the directory it defaults to. It should be a directory within sublime where it stores its settings and crap. For me that was C:\Program Files\Sublime Text 3\Data\Packages\User as I am running the portable version.


7) Sublime Text > Tools > Build Systems > MyPapyrus. Make sure that your new build is checkmarked.


8) Open a script, make sure your script is the active tab. Sublime Text > Tools > Build or hit CTRL+B or F7. You will get a pane at the bottom of Sublime with the output. It should say something like this.

Starting 1 compile threads for 1 files...
Compiling "sgo_QuestController"...
Compilation succeeded.


Batch compile of 1 files finished. 1 succeeded, 0 failed.
Starting assembly of sgo_QuestController
0 error(s), 0 warning(s)
Assembly succeeded
1 file(s) moved.
[Finished in 7.1s]




If it spews errors about not finding scripts like Quest or whatever your script depends on, you fucked up the build file, or you fucked up adding Sublime to MO, or you fucked up launching Sublime with MO. Hell, you could have even just fucked up installing the mods with MO, including forgetting something like SKSE or SKYUI SDK, or forgot to checkbox one of the mods that includes the scripts you need, or needing to extract files from BSA (like Sexlab Aroused). So many things.


Want to run Skyrim with Sublime and Creation Kit open to actually test? Unlock MO again and launch Skyrim.


No matter what, right click > compile in CK will no longer ever work as long as you use MO. Something about a bag of dicks or something. Whatever. Just do this. And remember to always close all ST3 instances and then re-launch it via MO when you plan to mod.


Recommended Comments

nope, i redact my last comment.


if you do this, the hacked hook.dll, your .pex file still ends up in the mod organiser overwrite directory instead of your proper mod.


i build way too often to add a series of clicks and drags from the overwrite dialog every time i build a script.

Link to comment

I've been developing all my mods with Sublime Text 3 and Mod Organizer pretty much since day 1, never really had a problem with it myself.


Just installing the Papyrus plugin from Sublime Package Control works fine, as far as I remember the only thing I had to do was edit it's Papyrus.sublime-build file.


Here's the contents of my build file for reference:

	"cmd": [
		"C:\\Games\\Steam\\SteamApps\\common\\Skyrim\\Papyrus Compiler\\PapyrusCompiler.exe",
		"-i=C:\\Games\\Steam\\SteamApps\\common\\Skyrim\\Data\\Scripts\\Source;C:\\Games\\Steam\\SteamApps\\common\\Skyrim\\Data\\Scripts\\Source\\Dawnguard;C:\\Games\\Steam\\SteamApps\\common\\Skyrim\\ModOrganizer\\mods\\SexLab Framework\\scripts\\Source;C:\\Games\\Steam\\SteamApps\\common\\Skyrim\\ModOrganizer\\mods\\SexLab - Aroused\\scripts\\source;C:\\Games\\Steam\\SteamApps\\common\\Skyrim\\ModOrganizer\\mods\\FNIS Behavior\\scripts\\source;C:\\Games\\Steam\\SteamApps\\common\\Skyrim\\ModOrganizer\\mods\\questVersioning\\scripts\\Source;C:\\Games\\Steam\\SteamApps\\common\\Skyrim\\ModOrganizer\\mods\\NetImmerse Override\\Scripts\\Source;$file_path",
	"file_regex": "(^.*\\.psc)\\(([0-9]*),([0-9]*)\\)",
	"selector": "source.papyrus"

The important parts are

"-i=<dependency scripts>;$file_path"

Which is just a list to any source directory I need to add a dependency to whenever needed to compile a script I'm working on. The final include here, "$file_path" means the directory of whatever file I'm compiling is included as well, so the scripts own source directory is automatically included.




I'm basically outputting it just up one folder from wherever the file being compiled currently is. So if I'm compiling "sexlab/scripts/source/SexLabUtil.psc" the output is put in "sexlab/scripts/source/../SexLabUtil.pex" aka "sexlab/scripts/SexLabUtil.pex" The overwrite folder in mod organizer never enters into it here, since it's being directly told to just output it up one folder.



As to compiling in the CK. I don't know why anybody would ever in human existance want to do that in the first place. There's virtually no real need to.

Link to comment
  • Create New...