TES5Edit Scripting Functions
Work in progress: To become the future home of scripting functions for TES5Edit. If you make scripts for TES5Edit please contribute to this page.
TES5Edit implements a script engine based on pascal syntax. The following table enumerates the functions exported by TES5Edit to the script engine that allows interacting with the editor's elements to perform various tasks such as finding records, fixing record conflicts, etc.
The information in the table is not complete so please contribute by explaining these functions, their uses and by fixing mistakes in this information.
The types described by this table such as IwbElement, IwbFile, etc.. are internal and not directly accessible but instead the script engine receives a generic type named IInterface which is common to every object type returned by TES5Edit. The reason the internal types are shown in this table is because some functions expect references to specific types even if the object reference is being hold by the generic IInterface variable.
Function | Returns | Arguments | Description |
---|---|---|---|
Add | IwbElement | container : IwbContainer, name : string, silent = true : boolean | Implemented for main records etc. |
AddElement | container : IwbContainer , element : IwbElement | ||
AdditionalElementCount | integer | container : IwbContainer | |
AddMasterIfMissing | file : IwbFile , mastername : string | ||
AddMessage | message : string | Adds a message line into the TES5Edit output panel | |
AddNewFile | IwbFile | Adds a new file and returns its reference | |
AddRequiredElementMasters | IwbFile | aSourceElement : IwbElement , aTargetFile : IwbFile , aAsNew : boolean | Add the elements master into the target file. |
Assigned | element : IwbElement | ||
CanContainFormIDs | boolean | element : IwbElement | |
CanMoveDown | boolean | element : IwbElement | |
CanMoveUp | boolean | element : IwbElement | |
ChangeFormSignature | record : IwbMainRecord , signature : TwbSignature | ||
Check | boolean | element : IwbElement | |
ChildGroup | IwbGroupRecord | record : IwbMainRecord | |
ChildrenOf | IwbMainRecord | group : IwbGroupRecord | |
CleanMasters | file : IwbFile | ||
CompareExchangeFormID | boolean | mainrecord : IwbMainRecord , oldFormID : Cardinal , aNewFormID : Cardinal | |
ConflictAllForMainRecord | TConflictThis | record : IwbMainRecord | Gets the ConflictThis argument of the record by calling ConflictLevelForMainRecord (see ctXxxxx enums) |
ConflictAllForNode | TConflictThis | node : IwbElement | Gets the ConflictAll argument of the record by calling ConflictLevelForMainRecord (see ctXxxxx enums) |
ConflictThisForMainRecord | TConflictThis | record : IwbMainRecord | Gets the ConflictThis argument of the record by calling ConflictLevelForMainRecord (see ctXxxxx enums) |
ConflictThisForNode | TConflictThis | node : IwbElement | Gets the ConflictAll argument of the record by calling ConflictLevelForMainRecord (see ctXxxxx enums) |
ContainingMainRecord | IwbMainRecord | element : IwbElement | |
DefType | TwbDefType | element : IInterface | returns the IwbElement::DefType (see dtXxxx enums) |
ElementAssign | IwbElement | container : IwbContainer , aInder : integer, [element : IwbElement], aOnlySK : boolean | Adds a new element to the container |
ElementByIndex | IwbElement | container : IwbContainer , index : integer | Gets an element in the container by index |
ElementByName | IwbElement | container : IwbContainer , name : string | Gets an element in the container by name |
ElementByPath | IwbElement | container : IwbContainer , path : string | Gets an element in the container by path |
ElementBySignature | IwbElement | container : IwbContainer , signature : string | Gets an element in the container by its signature |
ElementCount | integer | container : IwbContainer | Returns the number of elements in a container |
ElementExists | boolean | container : IwbContainer , name : string | Checks if the name of the element already exist in the container |
ElementType | TwbElementType | element : IwbElement | Returns the ElementType of the element |
Equals | boolean | element1 : IwbElement , element2 : IwbElement | Compares both elements by their ElementID |
FileByIndex | IwbFile | index : integer | Gets the file at the specified index |
FileByLoadOrder | IwbFile | loadorder : integer | Gets the file at the specified load order |
FileFormIDtoLoadOrderFormID | cardinal | file : IwbFile , formid : string/cardinal | |
FindChildGroup | IwbGroupRecord | group : IwbGroupRecord , aType : integer , aMainRecord : IwbMainRecord | |
FixedFormID | cardinal | aMainRecord : IwbMainRecord | |
FormID | cardinal | aMainRecord : IwbMainRecord | Obtains the FormID of the record |
FullPath | string | element : IwbElement | |
GetContainer | IwbContainer | element : IwbElement | Gets the container of the element |
GetEditValue | string | element : IwbElement | Gets the element's value represented as text |
GetElementEditValues | string | element : IwbElement , name : string | Gets the element's value represented as text |
GetElementNativeValues | variant | element : IwbElement , name : string | Gets the element's native value |
GetFile | IwbFile | element : IwbElement | Gets the file that defines the element |
GetFileName | string | file : IwbFile | Obtains the filename of the plugin file |
GetFormVersion | cardinal | mainrecord : IwbMainRecord | |
GetIsDeleted | boolean | mainrecord : IwbMainRecord | Indicates if the record has been deleted |
GetIsESM | boolean | file : IwbFile | Indicates if the plugin is an ESM file |
GetIsInitiallyDisabled | boolean | mainrecord : IwbMainRecord | |
GetIsPersistent | boolean | mainrecord : IwbMainRecord | |
GetIsVisibleWhenDistant | boolean | mainrecord : IwbMainRecord | |
GetLoadOrder | cardinal | file : IwbFile | Gets the global load order of the file |
GetLoadOrderFormID | cardinal | mainrecord : IwbMainRecord | Obtains the FormID with the current load order applied |
GetNativeValue | variant | element : IwbElement | Gets the element's native value |
GroupBySignature | file : IwbFile , signature : string | ||
GroupLabel | cardinal | group : IwbGroupRecord | |
GroupType | integer | group : IwbGroupRecord | |
HasGroup | boolean | file : IwbFile , signature : string | |
HasMaster | boolean | file : IwbFile , signature : string | Returns true if the file has a master file defined |
IndexOf | integer | container : IwbContainer , element : IwbElement | Gets the index of the element inside the collection |
InsertElement | container : IwbContainer , position : integer , element : IwbElement | Inserts an existing element inside a collection by position | |
IsEditable | boolean | element : IwbElement | |
IsInjected | boolean | element : IwbElement | |
IsMaster | boolean | record : IwbMainRecord | |
IsWinningOverride | boolean | record : IwbMainRecord | |
JumpTo | TConflictThis | record : IwbMainRecord , backward : boolean | Selects the specified record |
LastElement | IwbElement | container : IwbContainer | Obtains the last element in the collection |
LinksTo | IwbElement | element : IwbElement | Obtains the referenced element |
LoadOrderFormIDtoFileFormID | cardinal | file : IwbFile , aFormID : cardinal | |
MainRecordByEditorID | IwbMainRecord | group : IwbGroupRecord | Does not work for every case because its inefficient |
Master | IInterface | record : IwbMainRecord | |
MasterByIndex | IInterface | file : IwbFile , index : integer | |
MasterCount | cardinal | file : IwbFile | |
MasterOrSelf | IwbMainRecord | record : IwbMainRecord | |
MoveDown | element : IwbElement | Moves the element down | |
MoveUp | element : IwbElement | Moves the element up | |
Name | element : IwbElement | Obtains the name of the element | |
OverrideByIndex | IwbMainRecord | record : IwbMainRecord , index : integer | |
OverrideCount | cardinal | record : IwbMainRecord | |
Path | string | element : IwbElement | |
RecordByEditorID | IwbMainRecord | file : IwbFile , editorid : string | |
RecordByFormID | IwbMainRecord | file : IwbFile , formid : integer , aAllowInjected : boolean | |
RecordByIndex | IwbMainRecord | file : IwbFile , index : integer | |
RecordCount | cardinal | file : IwbFile | |
ReferencedByCount | cardinal | record : IwbMainRecord | |
ReferencedByIndex | IwbMainRecord | record : IwbMainRecord , index : integer | |
Remove | element : IwbElement | ||
RemoveByIndex | IwbElement | container : IwbContainer , index : integer , aMarkModified : boolean | |
RemoveElement | IwbElement | container : IwbContainer , element : IwbElement | |
RemoveNode | boolean | node : IwbElement | Removes the node from the file |
ResourceCopy | container : IwbContainer , fileName : string , pathOut : string , containerIndex : integer | ||
ResourceCount | cardinal | container : IwbContainer , aFileName : string , containers : TStrings | |
ResourceExists | boolean | container : IwbContainer , aFileName : string | |
ResourceList | container : IwbContainer , aContainerName : string , containers : TStrings | ||
ReverseElements | container : IwbContainer | ||
SetEditValue | element : IwbElement , value : string | Sets the value of the element as string | |
SetElementEditValues | container : IwbContainer , path : string , value : string | Sets the value as a string of the element by its path | |
SetElementNativeValues | container : IwbContainer , path : string , value : variant | Sets the native value of the element by its path | |
SetFormVersion | record : IwbMainRecord , version : integer | ||
SetIsDeleted | record : IwbMainRecord , value : boolean | ||
SetIsESM | file : IwbFile , value : boolean | ||
SetIsInitiallyDisabled | record : IwbMainRecord , value : boolean | ||
SetIsPersistent | record : IwbMainRecord , value : boolean | ||
SetIsVisibleWhenDistant | record : IwbMainRecord , value : boolean | ||
SetLoadOrderFormID | record : IwbMainRecord , loadOrderFormId : cardinal | ||
SetNativeValue | element : IwbElement , value : variant | Sets the native value of the element | |
ShortName | string | element : IwbElement | Gets the short name of the element |
Signature | string | record : IwbMainRecord | |
SortKey | string | element : IwbElement, aExtended: boolean | |
SortMasters | file : IwbFile | ||
wbCopyElementToFile | IwbElement | element : IwbElement , file : IwbFile , aAsNew : boolean , aDeepCopy : boolean | |
wbCopyElementToRecord | IwbElement | element : IwbElement , aMainRecord : IwbMainRecord , aAsNew : boolean , aDeepCopy : boolean | |
WinningOverride | boolean | record : IwbMainRecord |