Jump to content
  • 0

The Make New Record From Overrides script is broken


Daemonjax

Question

I need to use the "Make New Record From Overrides" script in SSEdit to fix a mod with large ref problems... however it fails on line 21:

[00:00] Start: Applying script "Make new records from overrides"
Override to new record: [REFR:04036C19] (places _SNSnowDriftL02 "Snow" [ACTI:0A001826] in GRUP Cell Temporary Children of [CELL:0400EDC5] (in DLC2SolstheimWorld "Solstheim" [WRLD:04000800] at 16,16))
Updating ref: REFR \ NAME - Base \ _SNSnowDriftL02 "Snow" [ACTI:0A001826]
[00:00] Exception in unit  line -1: Error in unit 'OverridesToNewRecords' on line 21 : Type mismatch
[00:00] Error during Applying script "Make new records from overrides": Error in unit 'OverridesToNewRecords' on line 21 : Type mismatch

 

Here's the script code:

	{
  Convert overrides into new records, all references are updated with reindexed FormIDs
  too so they must already exist in a plugin.
  For example if you have an override of worldspace record [WRLD:00001234]
  which references water [WATR:00005678], after applying script it would become
  [WRLD:01001234] referencing [WATR:01005678] (assuming plugin is loaded at index 01).
}
unit OverridesToNewRecords;
	procedure UpdateReferences(e: IInterface; ModLoadOrder: integer);
var ref: IInterface;
i: integer;
begin
  ref := LinksTo(e);
  if Assigned(ref) then
    if GetLoadOrder(GetFile(ref)) <> ModLoadOrder then begin
      i := GetLoadOrderFormID(ref);
      i := (i and $FFFFFF) or (ModLoadOrder shl 24);
      AddMessage('Updating ref: ' + Path(e) + ' \ ' + GetEditValue(e));
      SetEditValue(e, IntToHex(i, 8));
    end;
  
  if CanContainFormIDs(e) then
    for i := 0 to ElementCount(e) - 1 do
      UpdateReferences(ElementByIndex(e, i), ModLoadOrder);
end;
	function Process(e: IInterface): integer;
var
  i, fid: integer;
begin
  // not an override
  if IsMaster(e) then
    Exit;
    
  AddMessage('Override to new record: ' + Name(e));
  i := GetLoadOrder(GetFile(e));
  UpdateReferences(e, i);
  fid := GetLoadOrderFormID(e);
  fid := (fid and $FFFFFF) or (i shl 24);
  SetLoadOrderFormID(e, fid);
end;
	end.
 
	

 

Line 21 is SetEditValue(e, IntToHex(i, 8));

I could really use some help making this script work -- it comes with SSEdit, I didn't write it.

Edited by Daemonjax
words
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Guidelines, Privacy Policy, and Terms of Use.