Skip to content

Instantly share code, notes, and snippets.

@matortheeternal
Created July 17, 2017 20:50
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save matortheeternal/91e77ef306242137184dcfc1b9631669 to your computer and use it in GitHub Desktop.
Save matortheeternal/91e77ef306242137184dcfc1b9631669 to your computer and use it in GitHub Desktop.
xEdit Script for adding items to a leveled list. Based on a script by Sernmet.
unit userscript;
uses 'lib\mteFunctions';
var
slFormList: TStringList;
function Initialize: integer;
begin
slFormList := TStringList.create;
end;
function Process(e: IInterface): Integer;
begin
slFormList.AddObject(HexFormID(e), TObject(e));
end;
procedure CreateTransferFormList(lvli: IInterface);
var
flo, fli, flj: IInterface;
g: IInterface;
i: Integer;
bNoEntries: Boolean;
begin
bNoEntries := not ElementExists(lvli, 'Leveled List Entries');
fli := Add(lvli, 'Leveled List Entries', false);
while slFormList.Count > 0 do begin
flj := ElementAssign(fli, HighInteger, nil, false);
seev(flj, 'LVLO\Reference', slFormList[0]);
seev(flj, 'LVLO\Count', 1);
seev(flj, 'LVLO\Level', 1);
slFormList.Delete(0);
end;
if bNoEntries then
RemoveByIndex(fli, 0, true);
end;
function Finalize: Integer;
var
lvli: IInterface;
begin
lvli := RecordSelect('', 'LVLI');
CreateTransferFormList(lvli);
slFormList.free;
end;
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment