Jump to content

[LE] Compiling scripts externally, and esps


scorpiosixnine

Recommended Posts

This is probably a daft question, but does an esp contain copies of the compiled scripts that it uses, or does the game load the .pex versions from the Scripts folder at runtime?

 

I have things set up so that I can compile all of my scripts externally using the Papyrus Compiler (via a linux for windows bash script).

They are definitely compiling ok, and it's useful for dealing with build errors without having to interact with Creation Kit.

 

However, I find that the new script versions don't seem to be picked up in-game unless I open the esp in CK and re-compile the scripts there.

 

I had the idea that my externally compiled scripts would load fine without me needing to do this, but the evidence seems to suggest otherwise...

Link to comment
Share on other sites

Hmm, I think I've partially answered my own question.

 

I deleted the compiled .pex files, then ran the game, and the mod didn't work, so the .esp doesn't contain copies of them.

 

I then re-compiled them with Papyrus Compiler, ran the game again, and the mod worked ok (and the version of the scripts was the correct one).

 

So does anyone know why sometimes the game doesn't seem to pick up the newer scripts? Does it cache them somewhere or do some checking for timestamps (maybe comparing the .esp modification date with the .pex modification dates?)

Link to comment
Share on other sites

No, the .esp doesn't contain any script at all (the only ones you need in game are the .pex - .psc's are only there for editing purposes).

 

Scripts are loaded in game when they initialize, that means the very first time they run in the game. A MagicEffect script will only initialize the first time you cast the related spell, a quest script the first time the quest starts and alias scripts once the alias is filled and the quest running. Similarly, scripts which are attached to RefObjects in a cell will only initialize when that cell is loaded.

 

But all this however should not interfere with adding .pex in your game which have been compiled externally. Most of my long scripts (over 1000 lines or so), I compile outside of the CK and then manually place them in the game Data folder alongside the .esp. Sometimes I double-check in the CK that they load without errors, sometimes I don't. But regardless of doing that, they do load and run fine in game without needing to resave the .esp.

 

To my knowledge, they're no check for timestamps nor cache on scripts - but once a script has initialized in your game, it will become embedded in any save you make afterwards.

Link to comment
Share on other sites

The .bsa can store the scripts. It will use the .pex version of a script packed within it ... unless there is a .pex script by that same name in the script folder.
Possibly Skyrim is recompiling the source script into a new .pex at start then using that. Never actually tested for that ...
I do it one way or the other myself .. all packed (no scripts in the folders) or none packed (all scripts in the folders).


I also have my Skyrim set up with two different installs ... I use one to edit from and the other to play from.

My "play" version has no CK. So for me it's easy to keep all the scripts separated.

Edited by NexusComa
Link to comment
Share on other sites

There are only two sources of script information. The .pex files and the savegame file.

 

The version of the script first accessed when you start the game is the one that will be used until you close the game (with priority given for a loose .pex file if there is one and one from a .bsa using the same load order logic as the .esp files otherwise).

 

Any function (not the entire script, just the function) actively running when you make a save will be stored in the savegame file. When the game reloads that function will continue to run until it is complete using the original function definition, but any new calls to that function will use the version from whichever .pex file gets loaded.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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