Jump to content
  • 0

[SSEedit Script] How to skip over record that I'm not interested?


azzendix

Question

Problem:

I want to reduce script execution time. Is there any way to skip over records that I'm not interested? 

 

Detail:

I want to create SSEedit Script to check old form version(43). I modified "ApplyCustomScriptedFilter.pas" file.

The script is working as intended but it takes a long time to run through all records from ESP files. 

 

Here is the script.(only modified part)

function Filter(e: IInterface): Boolean;
begin
  if (Signature(e) <> 'TES4') or (GetFormVersion(e) <> '43') then 
	Exit;
  
  Result := 1;
end;

Just in case someone want to see it. Here is the original ApplyCustomScriptedFilter.pas file.(in spoiler) 

 

 

 

{
  Apply custom scripted filter for female NPC characters
}
unit ApplyCustomScriptedFilter;

function Filter(e: IInterface): Boolean;
begin
  if Signature(e) <> 'NPC_' then
    Exit;
  
  // Female flag
  Result := GetElementNativeValues(e, 'ACBS\Flags') and 1 > 0;
end;

function Initialize: Integer;
begin
  FilterConflictAll := False;
  FilterConflictThis := False;
  FilterByInjectStatus := False;
  FilterInjectStatus := False;
  FilterByNotReachableStatus := False;
  FilterNotReachableStatus := False;
  FilterByReferencesInjectedStatus := False;
  FilterReferencesInjectedStatus := False;
  FilterByEditorID := False;
  FilterEditorID := '';
  FilterByName := False;
  FilterName := '';
  FilterByBaseEditorID := False;
  FilterBaseEditorID := '';
  FilterByBaseName := False;
  FilterBaseName := '';
  FilterScaledActors := False;
  FilterByPersistent := False;
  FilterPersistent := False;
  FilterUnnecessaryPersistent := False;
  FilterMasterIsTemporary := False;
  FilterIsMaster := False;
  FilterPersistentPosChanged := False;
  FilterDeleted := False;
  FilterByVWD := False;
  FilterVWD := False;
  FilterByHasVWDMesh := False;
  FilterHasVWDMesh := False;
  FilterBySignature := False;
  FilterSignatures := '';
  FilterByBaseSignature := False;
  FilterBaseSignatures := '';
  FlattenBlocks := False;
  FlattenCellChilds := False;
  AssignPersWrldChild := False;
  InheritConflictByParent := True; // color conflicts
  FilterScripted := True; // use custom Filter() function

  ApplyFilter;

  Result := 1;
end;

end. 

 

 

 

I found the information about Group from Tes5Mod:Mod File Format but I don't know how to use it. I can't find any example or tutorial about it.

 

Groups

GRUPs are collections of records, and are used to improve scanning of files to make it easier to skip over records that the reading program is not interested in.

In addition to this, subgroups for WRLD and CELLS provide some useful structural information (e.g., the division of cell data into persistent and non-persistent references.)

 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Filter is not the best approach here since you want to check only TES4 header of each plugin

{
  Check form version of TES4 header in loaded plugins
}
unit UserScript;

const
  CheckFormVersion = 44;

function Initialize: integer;
var
  i: integer;
  plugin: IInterface;
begin
  for i := 0 to Pred(FileCount) do begin
    plugin := FileByIndex(i);
    if GetFormVersion(ElementByIndex(plugin, 0)) < CheckFormVersion then
      if Pos('.Hardcoded.', GetFileName(plugin)) = 0 then
        AddMessage('Old version plugin: ' + GetFileName(plugin));
  end;
  Result := 1;
end;

end.
Link to comment
Share on other sites

  • 0

Wow. Thank you so much, zilav.

I should ask here before start reading basic pascal tutorial, old script file and end up making nothing work.

(But I don't regret it because at least I tried ::D: )

 

Can I upload this script on Nexusmods?

I think it might useful for other people. I will give all credit to you.

Link to comment
Share on other sites

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.