Jump to content

Cleaning save files (removing deleted scripts' references)


tox2ik

Recommended Posts

Problem

After some initial trials at attaching a script to the Player in order to listen for certain events, I've re-written the script which did this incorrectly and changed its type as was necessary. This causes a problem in a particular saved game because apparently, old scripts are retained in the saves even after one removes them from the filesystem. My game loads an item and finds that a property in a script attached to that item has changed type and fails to assign a new pointer to that reference because the types differ.

The Property in question used to point at a script extending Actor, whereas now this property (variable name unchanged) points to a script extending ReferenceAlias. I guess that simply changing the name of the property would do the trick, but I wish learn if it's possible to remove the old script from the saved game entirely. That would allow my item-script to initialize that property correctly as it does when I start a completely new game.

 

Background-info

In order to attach a script to the Player such that this script receives the same events as the Player there are a number of steps to follow:

  1. Attach a Fill Type: "Specific Reference" quest alias to a new quest pointing at PlayerRef (00000014) (alias name: dovahkiin)
  2. Attach a Script extending ReferenceAlias to that alias (skript name: PlayerInventoryMonitorScript)
  3. Implement Event OnWhatever in the script (PlayerInventoryMonitorScript) for the events you wish to monitor
  4. Process event-data as you like

The usual "clean save" technique suggested as the ultimate uninstall-plugin-and-all-scripts solution will not work in this case. The reason for this is described in more detail in the UOSP bugtracker and even more thoroughly on the CK Wiki

 

Problem summary

In my previous attempt I was attaching a script which extended Actor to the quest alias. The problem was no events happening on the player were getting through to that script. In a separate script, attached to an item, I had a <myscriptType extends Actor> Property pointing at this script in order to retrieve collected data from events on the player. After changing the type of the monitor-script to ReferenceAlias, updating the Property in the item-script to <myscriptType extends ReferenceAlias> and deleting my old scripts, problems ensued.

 

Retracing steps

While writing this post and retracing my steps, I've remembered how I created the item with the problematic script:

In the original (now gone) .esp I dragged a diamond ring into a cell and attached scripts to it. Later, after finding out how to do things properly, I loaded my plugin without setting a master file, duplicated the entire cell, made appropriate changes, wrote new scripts and got rid of the old cell saving everything to a new .esp. The only thing giving me problems, is that the item to which I'm attaching the script already has a script attached (even though it's deleted). So maybe If I delete this ring and drag a new ring from the object window into my cell and reattach the script to it, things will sort them selves out. The problem remains though. I want to delete stale Objects and Scripts from my save because WARZONES, for example, leaves a whole load of them in my save.

 

Relevant log entries

[...] Cannot open store for class "toxPrintInvEncumbrance", missing file?

[...] warning: Unable to get type toxPrintInvEncumbrance referenced by the save game. Objects of this type will not be loaded.

[...] Cannot open store for class "toxitemcounterchest", missing file?

[...] warning: Unable to get type toxitemcounterchest referenced by the save game. Objects of this type will not be loaded.

[...] Cannot open store for class "toxPlayerScript2", missing file?

[...] warning: Unable to get type toxPlayerScript2 referenced by the save game. Objects of this type will not be loaded.

[...] warning: Could not find type toxPlayerScript2 in the type table in save

[...] warning: Could not find type toxPrintInvEncumbrance in the type table in save

[...] warning: Could not find type toxitemcounterchest in the type table in save

[...] error: Property pAliasRef on script toxIICounterRingScript attached to Item 11 in container (00000014) cannot be bound because <NULL alias> (1) on <NULL quest> (57000D62) is not the right type

[...] error: Property pAliasRef on script toxIICounterRingScript attached to (FF00111F) cannot be bound because <NULL alias> (1) on <NULL quest> (57000D62) is not the right type

item 11 in container 14 (player) must be the ring to which the new script is attached. The NULL alias and quest were defined in toxPrintInvEncumbrance and the old quest (not even listed any more).

 

More questions

How do I...

  • find the editor name (or any information) given an Object- or Ref-ID (like 57000D62)
    I could just go through all my stuff in the CK, but I would like to use the console for this.
    I know one can go the "other way" using `find' and `help'.
  • Edit game-saves?
    I'm guessing that there are no tools for this yet.
  • Write scripts that properly uninstall themselves (or alternatively) write uninstall scripts that remove my crap from your savegame.
    Taking a look at how "Imps More Complex Needs" handles uninstalls would be a start.

 

Edit:

In case anyone ever finds this, there is this discussion defining these problems more clearly and suggesting a couple of potential work-arounds:

old-versions-mods-conflicting-with-newer-ones

Edited by tox2ik
Link to comment
Share on other sites

  • 10 months later...

This only way to do this is to find those tables in the save game with a hex editor and set all those bytes to 0. Effectively removing the records. The save file does not have any hash checking so unless you remove the incorrect parts, the game save does not get damaged.

 

I once changed the formid of a property reference and I had to hex edit my game save for the script to point to the right reference.

Link to comment
Share on other sites

find the editor name (or any information) given an Object- or Ref-ID (like 57000D62)

I could just go through all my stuff in the CK, but I would like to use the console for this.

I know one can go the "other way" using `find' and `help'.

57000D62

 

The first two digits are the hex value of the mod's load order position. You can find that by looking at your plugin list in NMM or Wyre Bash

The last 6 digits correspond to the form ID number as found on the item in the Creation Kit.

I do not think you can reverse look up an item based on it's ID number within the game console. You may have to resort to determining what mod it is from and then load that mod in the Creation Kit and find that item.

 

Edit game-saves?

I'm guessing that there are no tools for this yet.

No truly safe tools... Anything done with your save game requires having it backed up cause it could become unplayable.

 

Write scripts that properly uninstall themselves (or alternatively) write uninstall scripts that remove my crap from your savegame.

Taking a look at how "Imps More Complex Needs" handles uninstalls would be a start.

A better solution would be to not revamp your scripts in such a way that the old is no longer needed. Else insist it be used on new games only. There is no "safe" uninstall method. Script data will always be present in your save game. The trick is getting it to no longer want to be used. Yes, you can set it up to be shut down in such a way that update cycles and script loops no longer run. But there are ways to script so that you don't need to do that either. The best solution is to not place scripts on objects that will no longer be present in game when the mod is fully uninstalled. Without the object to call the script, stored data won't be called up to cause issues.

 

A new game that has never seen the mod or scripts should solve many of the "issues" that your Papyrus log shows.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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