Documentation: RecordScript
The RecordScript snippets allow you to apply advanced record structure and data modifications in records by processing rules or a PluginScript.
Description
The RecordScript code syntax is build for being written in one line, so it can easily be used in a processing rule statement.
All commands directly followed by their fixed amount of parameters are written consecutively in the snippet.
Finding and creation commands provide a sub node reference, which can be used in sub RecordScript in ( ) bracket syntax directly after that command.
FO4Edits record structure
All data in a record is structured in a tree containing many named or indexed (sub) nodes. You are starting at the top node, which is basically the record it-self, like a WEAP record.
Example 1: The name of most records is stored in the sub main node "FULL - Name". Tree path: MainRecordNode > FULL - Name
Example 2: Keywords are stored in the sub main node "KWDA - Keywords" as ordered sub nodes. Tree path (of one specific keyword): MainRecordNode > KWDA - Keywords > Keyword
Example 3: The value of an armor is stored in a sub node "Value" in the sub node "DATA - DATA". Tree path: MainRecordNode > DATA - DATA > Value
All main commands will applied to the source record node.
While inside a ( ) bracket part, all commands will applied to the node provided by the command before those ( ) brackets.
Commands
All commands are case-insensitive.
FindNode {node path} ( [RecordScript] )
Search a sub node from the current node by a node path (default xEdit script syntax, using xEdit function "ElementByPath").
If a sub node is found, the RecordScript in the following ( ) brackets will be executed on that sub node.
AddNode {signature or element name} ( [RecordScript] )
Add a main sub node in the current node by signature or element name (using xEdit function "Add").
If a sub node is created, the RecordScript in the following ( ) brackets will be executed on that sub node.
AddEntry ( [RecordScript] )
Add a sorted/ordered sub node at the end in the current node (using xEdit function "ElementAssign").
If a sub node is created, the RecordScript in the following ( ) brackets will be executed on that sub node.
AddEntryAt {insertIndex} ( [RecordScript] )
Add a sorted/ordered sub node at position {insertIndex} in the current node (using xEdit function "ElementAssign").
If a sub node is created, the RecordScript in the following ( ) brackets will be executed on that sub node.
SetValue {value}
Set the value of the current node to {value} (using xEdit function "SetEditValue").
SetReference {refSignature} {refEditorId}
Set the value of the current node to a reference to the node defined by signature {refSignature} and the EditorID {refEditorId}.
Debug
Output information about the current node in the message log.
This command have no parameters and doesn't do any actions beside printing information.
Examples
RecordScript for adding missing Object Templates for ARMO records:
RecordScript creating a MODL node just containing an INDX entry:
RecordScript creating a MODL node with INDX entry and MODL entry referencing to a ARMA entry
Example for using a RecordScript in a normal processing rule:
Example for using a RecordScript in a PluginScript:
0 comments