Jump to content

Help: xEdit script to mark multiple records as "Deleted"


Recommended Posts

Trying to do a mass cell cleanup, and apparently there is no way to set the Deleted record flag on multiple records at once.  There is a stock script to mark them Persistent or not Persistent, but to mark Deleted I'm having to do them one at a time.

Does anyone have a script which will set the Deleted flag on multiple things at once?

Link to comment
Share on other sites

This would set the InitiallyDisabled record flag on the selected REFR and ACHR records (comment out the Signature filter accordingly).

Notes:

   - References whose IsDisabled() state have already been saved in a save game cannot be disabled mid-playthrough by changing the record flag because the engine favors the save.

   - I don't remember exactly which refs but I think the ones that Disable() or Enable() have been called on and maybe persistent refs are saved.

unit UserScript;

var
  Count: integer;
  
function Process(e: IInterface): integer;
var
  S: string;
begin
  Result := 0;
  
  S := Signature(e);

  // Signature filter
  if 
    (S <> 'REFR') and
    (S <> 'ACHR')
  then
    Exit;

  // Notify us
  AddMessage('Disabling: ' + Name(e));
  
  // Disabled
  SetIsInitiallyDisabled(e, True);

  // Count how many records are being disabled
  Inc(Count);
end;

function Finalize: integer;
begin
  AddMessage('Disabled: ' + IntToStr(Count));
end;

end.

 

Edited by LarannKiar
Link to comment
Share on other sites

1 hour ago, LarannKiar said:

This would set the InitiallyDisabled record flag on the selected REFR and ACHR records (comment out the Signature filter accordingly).

Notes:

   - References whose IsDisabled() state have already been saved in a save game cannot be disabled mid-playthrough by changing the record flag because the engine favors the save.

   - I don't remember exactly which refs but I think the ones that Disable() or Enable() have been called on and maybe persistent refs are saved.

Thanks, appreciate it.  I was taking a break from stellar engineering and cleaning up some ship habs, because unlike Bethesda I'm not a complete and utter slob, and because I also understand that in an environment likely to lose artificial gravity from time to time you don't leave random junk lying around unsecured so that it becomes a flying hazard to personnel and important equipment.  Setting those objects to IsDisabled does indeed remove them mid-playthrough.

Is that Pascal?  I learned that forever ago, when it was supposed to replace FORTRAN, but I thought it had fallen out of favor.  Not that it matters, I suck as a programmer lol  I can smash together crude bash scripts to automate things if I really need to, but that's about it.  Still, kinda surprised xEdit doesn't use python.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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