User:DavidJCobb/Sandbox/TES5Edit Scripting Functions
TES5Edit Scripting Functions
xEdit scripts only have access to a generic type called IInterface, which wraps around every object that xEdit returns. However, different types are used internally to classify different objects. To illustrate this with an example: files are coded as IwbFile objects, while forms are coded as IwbMainRecord objects. However, an xEdit script will only ever see IInterface objects, and any IInterface can be a IwbFile or an IwbMainRecord. Functions like GetIsESM can be called on any IInterface, but are designed to work with IwbFiles and will not produce a meaningful result for other types (i.e. GetIsESM would always return false for any other type).
The functions below are sorted by the internal types that they operate on. This is to make it easier to find certain functions and to make this page easier to maintain (because frankly, fixing up row colors on a massive table is just a big disincentive to even editing the page).
The relationships between internal types are as follows:
IwbElement └ IwbContainerBase ├ IwbContainer │ ├ IwbDataContainer │ │ ├ IwbFileHeader │ │ └ IwbRecord │ │ ├ IwbGroupRecord │ │ ├ IwbMainRecord │ │ └ IwbSubRecord │ │ │ └ IwbFile │ └ IwbContainerElementRef IwbResource IwbResourceContainer │ IwbBA2File │ IwbBSAFile └ IwbFolder Misc functions └ DDS └ NIF
Global functions
These functions can be called on anything and should return a meaningful result.
Function | Returns | Arguments | Description |
---|---|---|---|
Assigned | boolean | aeElement: IwbElement | {{{description}}} |
ObjectToElement | IInterface | akObject | If you have stored an IInterface inside of a TList or TStringList, you must call this function when retrieving the object from the list, i.e. ObjectToElement(myList.Items[0]) .
|
FullPathToFilename | string | asFilename: string | Returns the full path to the filename asFilename. |
EnableSkyrimSaveFormat | Unknown. | ||
GetRecordDefNames | akList: TStrings | Unverified: Modifies akList by adding entries based on the contents of the global wbRecordDefs. | |
wbFilterStrings | akListIn: TStrings; akListOut: TStrings; asFilter: String |
Modifies akListOut, adding every entry in akListIn that contains asFilter. | |
wbRemoveDuplicateStrings | akList: TStringList | Modifies akList, removing duplicate entries that it contains. |
IwbElement
These functions can be called on any IwbElement IInterface.
Function | Returns | Arguments | Description |
---|---|---|---|
BaseName | string | aeElement: IwbElement | Presumably returns the name of the element's base form, if any. |
BuildRef | aeElement: IwbElement | Builds reference information for the element. Note that this function will run even if reference information has already been built. | |
CanContainFormIDs | boolean | aeElement: IwbElement | Unknown. |
CanMoveDown | boolean | aeElement: IwbElement | Returns true if the element is part of an array and can be moved further down using MoveDown. |
CanMoveUp | boolean | aeElement: IwbElement | Returns true if the element is part of an array and can be moved further up using MoveUp. |
Check | string | aeElement: IwbElement | Unknown. Used in the "Check For Errors" script. |
ClearElementState | aeElement: IwbElement; aiState: TwbElementState |
Unknown. See also: GetElementState, SetElementState. | |
DefType | TwbDefType | aeElement: IwbElement | Returns the def-type of the element. |
DisplayName | string | aeElement: IwbElement | Returns the display name of the element, if it has one. |
ElementAssign | IwbElement | aeContainer: IwbContainer; aiIndex: integer; aeSource: IwbElement; abOnlySK: boolean |
Copy the contents of one element into a container element, or create and append an element to a container.
Sample: there is a script to copy VMAD subrecords "Skyrim - Copy VMAD subrecord.pas" |
ElementType | TwbElementType | aeElement: IwbElement | Returns the type of the element. This is one of the following values: etFile, etMainRecord, etGroupRecord, etSubRecord, etSubRecordStruct, etSubRecordArray, etSubRecordUnion, etArray, etStruct, etValue, etFlag, etStringListTerminator,etUnion, etStructChapter. |
EnumValues | string | aeElement: IwbElement | If aeElement is a set of named enum values, this function returns the names of any values that have been set, separated with spaces. |
Equals | boolean | aeElement1: IwbElement; aeElement2: IwbElement |
{{{description}}} |
FlagValues | string | aeElement: IwbElement | If aeElement is a set of flags, this function returns the names of all set flags, separated with spaces. |
FullPath | string | aeElement: IwbElement | Returns the full path to the element, going all the way down to its containing file. You could pass that path to functions like ElementByPath. |
GetContainer | IwbContainer | aeElement: IwbElement | Returns the element's container. |
GetContainingMainRecord | IwbMainRecord | aeElement: IwbElement | Returns the main record that contains the element. |
GetEditValue | string | aeElement: IwbElement | Returns a string representation of the element's value. See also: SetEditValue, GetElementEditValues, SetElementEditValues. |
GetElementState | TwbElementState | aeElement: IwbElement; aiState: TwbElementState |
Unknown. See also: ClearElementState, SetElementState. |
GetFile | IwbFile | aeElement: IwbElement | Returns the file that contains the element. |
GetNativeValue | variant | aeElement: IwbElement | Returns the element's value. See also: SetNativeValue, GetElementNativeValues, SetElementNativeValues. |
IsEditable | boolean | aeElement: IwbElement | Returns true if the record can be edited. In some cases, xEdit will block edits to files like Skyrim.esm. |
IsInjected | boolean | aeElement: IwbElement | Returns true if the element is an injected record. |
LinksTo | IwbElement | aeElement: IwbElement | Obtains the referenced element. Not to be confused with ReferencedBy Elements. Call this function on any container element (etSubRecord) to get the iwbMainRecord of that form. (Ex: Calling LinksTo() on any 'LNAM - FormID' subRecord found in a FormID List will return the IwbMainRecord of that record). |
MarkModifiedRecursive | aeElement: IwbElement | Presumably marks the element and all of its descendants as modified. | |
MoveDown | aeElement: IwbElement | If the element is part of an array, this function moves it down by one slot. See also: CanMoveDown. | |
MoveUp | aeElement: IwbElement | If the element is part of an array, this function moves it up by one slot. See also: CanMoveUp. | |
Name | string | aeElement: IwbElement | Returns the name of the element, if it has one. |
Path | string | aeElement: IwbElement | Returns the path to the element. You could pass that path to functions like ElementByPath. See also: FullPath. |
PathName | string | aeElement: IwbElement | Unknown. |
Remove | aeElement: IwbElement | Removes the element from its file. | |
ReportRequiredMasters | aeElement: IwbElement; akList: TStrings; akUnknown; akUnknown |
Unknown. | |
SetEditValue | string | aeElement: IwbElement; asValue: string |
Sets the element's value to one that matches the string representation passed in. See also: GetEditValue, GetElementEditValues, SetElementEditValues. |
SetElementState | TwbElementState | aeElement: IwbElement; aiState: TwbElementState |
Unknown. Returns the value prior to modification. See also: ClearElementState, GetElementState. |
SetNativeValue | string | aeElement: IwbElement; avValue: variant |
Sets the element's value. See also: GetNativeValue, GetElementNativeValues, SetElementNativeValues. |
SetToDefault | aeElement: IwbElement | Unknown. | |
ShortName | string | aeElement: IwbElement | Returns the short name of the element, if it has one. |
SortKey | string | aeElement: IwbElement | Returns a string unique to the element entered. This can be used for sorting elements or for comparing them; for example, you could compare the SortKey for two elements in records which override each other to see if they are different from each other. |
wbCopyElementToFile | IwbElement | aeElement: IwbElement; aeFile: IwbFile; abUnknown1: boolean; abUnknown2: boolean |
Details unknown. Returns the copied element. |
wbCopyElementToFileWithPrefix | IwbElement | aeElement: IwbElement; aeFile: IwbFile; abUnknown1: boolean; abUnknown2: boolean; akUnknown; akUnknown; akUnknown |
Details unknown. Returns the copied element. |
wbCopyElementToRecord | IwbElement | aeElement: IwbElement; aeRecord: IwbMainRecord; abUnknown1: boolean; abUnknown2: boolean |
Details unknown. Returns the copied element. |
IwbContainer
Function | Returns | Arguments | Description |
---|---|---|---|
Add | IwbElement | aeContainer: IwbContainer; asNameOrSignature: string; abSilent: boolean |
Creates a child element with the name-or-signature asNameOrSignature in aeContainer if no such child already exists; otherwise, marks the existing child as modified. Returns the created or existing element. |
AddElement | aeContainer: IwbContainer; aeElement: IwbElement |
Adds aeElement as a child of aeContainer. Throws an error if aeElement already has a container. | |
AdditionalElementCount | integer | aeContainer: IwbContainer | Unknown. |
ContainerStates | byte | aeContainer: IwbContainer | Unknown getter. |
ElementByIndex | IwbElement | aeContainer: IwbContainer; aiIndex: integer |
Returns the aiIndex-th child element in aeContainer. See also: ElementCount. |
ElementByName | IwbElement | aeContainer: IwbContainer; asName: string |
Searches aeContainer for the child element with name asName, and returns the found element or Nil. See also: ElementExists. |
ElementByPath | IwbElement | aeContainer: IwbContainer; asPath: string |
Searches aeContainer for the descendant element specified by path asPath, and returns the found element or Nil. |
ElementBySignature | IwbElement | aeContainer: IwbContainer; asSignature: string |
Searches aeContainer for the child element with signature asSignature, and returns the found element or Nil. |
ElementCount | integer | aeContainer: IwbContainer | Returns the number of child elements in aeContainer. See also: ElementByIndex. |
ElementExists | boolean | aeContainer: IwbContainer; asName: string |
Returns true if aeContainer as a child element whose name is asName. See also: ElementByName. |
IndexOf | integer | aeContainer: IwbContainer; aeChild: IwbElement |
Returns the index of aeChild in aeContainer, or -1 if aeChild is not a child element of aeContainer. |
InsertElement | aeContainer: IwbContainer; aiPosition: Integer; aeElement: IwbElement |
Inserts aeElement as a child of aeContainer at the specified position. | |
IsSorted | boolean | aeContainer: IwbSortableContainer | Unknown. |
LastElement | IwbElement | aeContainer: IwbContainer | Returns the last child element in aeContainer, or Nil if there are no child elements. |
RemoveByIndex | IwbElement | aeContainer: IwbContainer; aiIndex: integer |
Removes the aiIndex-th child from aeContainer, and returns it. |
RemoveElement | IwbElement | aeContainer: IwbContainer; avChild: variant |
Removes avChild from aeContainer and returns the removed element. The avChild argument can be: the index of an element to remove from an array container; the name or signature of an element to remove; or an IwbElement to remove. |
ReverseElements | aeContainer: IwbContainer | Reverses the order of the child elements in aeContainer. | |
SetElementEditValues | aeContainer: IwbContainer; asPath: string; asValue: string |
Finds the element within aeContainer specified by asPath, and sets its value based on the string representation asValue. | |
SetElementNativeValues | aeContainer: IwbContainer; asPath: string; avValue: variant |
Finds the element within aeContainer specified by asPath, and sets its value to asValue. |
IwbMainRecord
Function | Returns | Arguments | Description |
---|
IwbGroupRecord
Function | Returns | Arguments | Description |
---|---|---|---|
ChildrenOf | IwbMainRecord | aeGroup: IwbGroupRecord | If aeGroup is a child group, this function returns the main record that it is associated with. For example, a Dialogue Topic (DIAL) is followed by a group (GRUP) that contains its Infos (INFO); and passing that GRUP to this function would retrieve the DIAL. Cells (CELL) and Worldspaces (WRLD) have their contents set up similarly to Dialogue Topics, so this function will work with them as well. |
FindChildGroup | IwbGroupRecord | aeGroup: IwbGroupRecord; aiType: integer; aeMainRecord: IwbMainRecord; |
Unknown. |
GroupLabel | cardinal | aeGroup: IwbGroupRecord | Unknown. |
GroupType | integer | aeGroup: IwbGroupRecord | Unknown. |
MainRecordByEditorID | IwbMainRecord | aeGroup: IwbGroupRecord; asEditorID: string |
Searches aeGroup for a main record whose editor ID is asEditorID and returns the matching record or Nil. This is not a performant function. |
IwbFile
Function | Returns | Arguments | Description |
---|
IwbResource
Function | Returns | Arguments | Description |
---|
Misc functions
Function | Returns | Arguments | Description |
---|
NIF functions
Function | Returns | Arguments | Description |
---|
DDS functions
Function | Returns | Arguments | Description |
---|---|---|---|
wbDDSStreamToBitmap | TBitmap | akStream: TStream; akBitmapOut: TBitmap |
Unknown. |
wbDDSDataToBitmap | TBitmap | akData: TBytes; akBitmapOut: TBitmap |
Unknown. |
wbDDSResourceToBitmap | TBitmap | akUnknown; akBitmapOut: TBitmap |
Unknown. |