Created
July 17, 2017 20:50
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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