-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path13-Scripting-Functions.html
2250 lines (2239 loc) · 107 KB
/
13-Scripting-Functions.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
layout: default
title: xEdit Scripting Functions
---
<h1 class="grhead1">Main Table Of Contents</h1>
<div id="tableOfContents" class="grid-toc">
<div class="toc1">
<h2 class="grhead2"><a href="index.html">1. Introduction</a></h2>
<h2 class="grhead2"><a href="2-overview.html">2. Overview</a></h2>
<h2 class="grhead2"><a href="3-basicuse.html">3. xEdit Basic Use</a></h2>
<h2 class="grhead2"><a href="4-modgroups.html">4. ModGroups</a></h2>
<h2 class="grhead2"><a href="5-conflict-detection-and-resolution.html">5. Conflict Detection and Resolution</a></h2>
<h2 class="grhead2"><a href="6-themethod.html">6. The Method</a></h2>
<h2 class="grhead2"><a href="7-mod-cleaning-and-error-checking.html">7. Mod Cleaning and Error Checking</a></h2>
<h2 class="grhead2"><a href="8-managing-mod-files.html">8. Managing Mod Files</a></h2>
<h2 class="grhead2"><a href="9-mod-utilities.html">9. Mod Utilities</a></h2>
</div>
<div class="toc2">
<h2 class="grhead2"><a href="10-fo3edit-faq.html">10. FO3Edit FAQ</a></h2>
<h2 class="grhead2"><a href="11-appendix.html">11. Appendix</a></h2>
<h2 class="grhead2"><a href="12-cheat-sheets-and-quick-reference-charts.html">12. Cheat Sheets and Quick Reference Charts</a></h2>
<h2 class="grhead2"><a href="13-Scripting-Functions.html">13. Scripting Functions</a></h2>
<h2 class="grhead2"><a href="14-Scripting-Resources.html">14. Scripting Resources</a></h2>
<h2 class="grhead2"><a href="15-tutorials.html">15. Tutorials</a></h2>
<h2 class="grhead2"><a href="16-xLODGen.html">16. xLODGen</a></h2>
<h2 class="grhead2"><a href="17-DynDoLod.html">17. DynDoLod</a></h2>
<h2 class="grhead2"><a href="18-whatsnew.html">18. xEdit What's New and Version Info</a></h2>
</div>
</div>
<h1>{{ page.title }}</h1>
<h2 id="Contents">Contents...</h2>
<p class="list-1">• <a href="#Description">13.1 Description</a></p>
<p class="list-1">• <a href="#UsingtheDelphiIDEtoEditTES5EditScripts">13.2 Using the Delphi IDE to Edit TES5Edit Scripts</a></p>
<p class="list-1">• <a href="#InstructionstogetstartededitingxEditscriptswithDelphi">13.3 Instructions to get started editing xEdit scripts with Delphi</a></p>
<p class="list-1">• <a href="#TES5EditGlobalVariables">13.4 TES5Edit Global Variables</a></p>
<p class="list-1">• <a href="#TES5EditScriptingFunctions">13.5 TES5Edit Scripting Functions</a></p>
<p class="list-1">• <a href="#Globalfunctions">13.6 Global functions</a></p>
<p class="list-1">• <a href="#IwbElement">13.7 IwbElement</a></p>
<p class="list-1">• <a href="#IwbContainer">13.8 IwbContainer</a></p>
<p class="list-1">• <a href="#IwbFile">13.9 IwbFile</a></p>
<p class="list-1">• <a href="#IwbMainRecord">13.10 IwbMainRecord</a></p>
<p class="list-1">• <a href="#IwbGroupRecord">13.11 IwbGroupRecord</a></p>
<p class="list-1">• <a href="#IwbResource">13.12 IwbResource</a></p>
<p class="list-1">• <a href="#Miscfunctions">13.13 Misc functions</a></p>
<p class="list-1">• <a href="#NIFfunctions">13.14 NIF functions</a></p>
<p class="list-1">• <a href="#DDSfunctions">13.15 DDS functions</a></p>
<p class="list-1">• <a href="#ScriptStructure">13.16 Script Structure</a></p>
<p class="list-1">• <a href="#BaseScriptFunctions">13.17 Base Script Functions</a></p>
<p class="list-1">• <a href="#Hotkeys">13.18 Hotkeys</a></p>
<p class="list-1">• <a href="#ScriptReferences">13.19 Script References</a></p>
<p class="list-1">• <a href="#ScriptUserInterface">13.20 Script User Interface</a></p>
<p class="list-1">• <a href="#SimpleScriptSample">13.21 Simple Script Sample</a></p>
<p class="list-1">• <a href="#Pascalimplementation">13.22 Pascal implementation</a></p>
<p class="list-1">• <a href="#xEditextensionstoJvInterpreter">13.23 xEdit extensions to JvInterpreter</a></p>
<p class="list-1">• <a href="#Unsupportedlanguagefeatures">13.24 Unsupported language features</a></p>
<p class="list-1">• <a href="#Unsupportedoperators">13.25 Unsupported operators</a></p>
<p class="list-1">• <a href="#Unsupportedkeywords">13.26 Unsupported keywords</a></p>
<p class="list-1">• <a href="#Unsupportedclassesandtools">13.27 Unsupported classes and tools</a></p>
<div id="s_11-1"></div>
<h3 id="Description">13.1 - Description</h3>
<p>Work in progress: To become the future home of scripting functions for TES5Edit. If you make scripts for TES5Edit please contribute to this page.</p>
<p class="empty"> </p>
<p>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.</p>
<p class="empty"> </p>
<p>The information in the table is not complete so please contribute by explaining these functions, their uses and by fixing mistakes in this information.</p>
<p class="empty"> </p>
<div id="s_11-2"></div>
<h3 id="UsingtheDelphiIDEtoEditTES5EditScripts">13.2 - Using the Delphi IDE to Edit TES5Edit Scripts</h3>
<p>As of TES5Edit version 3.2.1, there is a file in the <code>Edit Scripts</code> directory called <a href="href="https://github.com/TES5Edit/TES5Edit/blob/dev/Edit%20Scripts/xEditAPI.pas">xEditAPI.pas</a></p>
<p class="empty"> </p>
<p>The contents of that file match what is published here. The xEditAPI.pas includes xEdit API declarations to be used for editing scripts using Delphi. With this file you can now edit xEdit scripts using Delphi. This gives you full IDE benefits like checking for warnings and errors before executing your script, as well as intellisense and code insights.</p>
<p class="empty"> </p>
<p>For example purposes in this documentation, we assume a user created xEdit script named <code>GreatScript.pas</code>. However, you can name your script almost anything. There are some limitations though, because the name of the script must match the unit declaration of the script, and unit names have limitations. See <a href="href="http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Fundamental_Syntactic_Elements_(Delphi)#Identifiers">Delphi Identifiers</a></p>
<p class="empty"> </p>
<h3 id="InstructionstogetstartededitingxEditscriptswithDelphi">13.3 - Instructions to get started editing xEdit scripts with Delphi</h3>
<p class="list-1">• Download the free Delphi Starter edition, called RAD Studio (current version is 10.2) from <a href="https://www.embarcadero.com/products/delphi/starter">Embarcadero Delphi Starter</a></p>
<p class="list-1">• Create new console application project named <code>GreatScriptApp</code></p>
<p class="list-1">• Add the files <code>xEditAPI.pas</code> and <code>GreatScript.pas</code> to the project (menu Project -> Add to project)</p>
<p class="list-1">• At the top of the script, modify or add the <code>unit</code> clause. The name of the unit must match exactly the filename of your script without the .pas extension.</p>
<p class="list-1">• Then add/update the <code>interface</code>, <code>implementation</code>, and <code>uses</code> clauses to your script below. Afterwards, the top of your script file should look like this:</p>
<p class="empty"> </p>
<pre>
unit GreatScript;
interface
implementation
uses xEditAPI, Classes, SysUtils, StrUtils, Windows;
</pre>
<p class="empty"> </p>
<p class="list-1">• You can add additional Delphi units to the <code>uses</code> clause needed, for example <code>IniFiles</code> if script works with them.</p>
<p class="list-1">• Check that project can be compiled <code>Ctrl+F9</code> and the same script can be applied in xEdit without errors.</p>
<p class="list-1">• While editing your script, before running it in xEdit, press <code>Ctrl+F9</code> in Delphi to compile and ensure that the code is valid.</p>
<p class="list-1">• You can also modify the GreatScriptApp file and have it run your xEdit script from Delphi by pressing <code>F9</code>. Make GreatScriptApp look something like this:</p>
<p class="empty"> </p>
{% raw %}
<pre>
program GreatScriptApp;
{$APPTYPE CONSOLE}
{$R *.res}
uses
Windows,
Winapi.ShellApi,
System.SysUtils,
xEditAPI in 'C:\Games\FO4Edit 3.2\Edit Scripts\xEditAPI.pas';
GreatScript in 'C:\Games\FO4Edit 3.2\Edit Scripts\GreatScript.pas',
begin
try
ShellExecute(0, Nil, 'C:\Games\FO4Edit 3.2\FO4Edit.exe', '-script:"GreatScript.pas" -nobuildrefs', 'C:\Games\FO4Edit 3.2', SW_SHOWNORMAL);
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.
</pre>
{% endraw %}
<p class="empty"> </p>
<div>
<a href="#s_111" class="drkbtn">Previous Section</a>
<a href="#s_112" class="drkbtn">Top of this Group</a>
</div>
<div id="s_11-3"></div>
<h3 class="scriptHeader" id="TES5EditGlobalVariables">13.4 - TES5Edit Global Variables</h3>
<p>These are predefined <b>read-only</b> variables that can be called at any time.</p>
<p class="empty"> </p>
<table class="scriptTable">
<tr>
<th> Name </th>
<th> Type </th>
<th> Description </th>
<th> Note </th>
</tr>
<tr>
<td><b>DataPath</b></td>
<td> String</td>
<td> Provides the file path to Skyrim's data folder as a String</td>
<td> </td>
</tr>
<tr>
<td><b>ProgramPath</b></td>
<td> String</td>
<td> Provides the file path to Tes5edit's installation folder as a String</td>
<td> </td>
</tr>
<tr>
<td><b>ScriptsPath</b></td>
<td>String</td>
<td>Provides the file path to Tes5Edit's 'Edit Scripts' folder as a String.</td>
<td>If launching TES5Edit via a .tes5pas file, ScriptsPath will change to the directory where the .te5pas file is located. (therefore if your script has any .pas file it is grabbing functions from, they also need to be in the that same directory.)</td>
</tr>
<tr>
<td><b>FileCount</b></td>
<td>Integer</td>
<td>Provides the number of loaded files in your current TES5Edit session</td>
<td>"Skyrim.Hardcoded.keep.this..." (aka. Skyrim.exe) is considered a file and is reflected in this variable.</td>
</tr>
<tr>
<td><b>wbAppName</b></td>
<td> String</td>
<td> Returns 'TES5','TES4','FNV','FO3'</td>
<td> </td>
</tr>
<tr>
<td><b>wbVersionNumber</b></td>
<td> Integer</td>
<td> Returns xEdit version number.</td>
<td> </td>
</tr>
</table>
<p class="empty"> </p>
<div>
<a href="#s_112" class="drkbtn">Previous Section</a>
<a href="#s_113" class="drkbtn">Top of this Group</a>
</div>
<p><!--/.level-nav--></p>
<div id="s_11-4"></div>
<h3 class="scriptHeader" id="TES5EditScriptingFunctions">13.5 - TES5Edit Scripting Functions</h3>
<p class="empty"> </p>
<p>xEdit scripts only have access to a generic type called <i>IInterface</i>, 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 <i>IwbFile</i> objects, while forms are coded as <i>IwbMainRecord</i> objects. However, an xEdit script will only ever see IInterface objects, and any IInterface can be a IwbFile <i>or</i> an IwbMainRecord. Functions like <i>GetIsESM</i> 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. <i>GetIsESM</i> would always return false for any other type).</p>
<p class="empty"> </p>
<p>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).</p>
<p class="empty"> </p>
<p>The relationships between internal types are as follows:</p>
<p class="empty"> </p>
<p> <a href="#IwbElement">IwbElement</a></p>
<p class="list-1">+ IwbContainerBase</p>
<p class="list-1">+ <a href="#IwbContainer">IwbContainer</a></p>
<p> | + IwbDataContainer</p>
<p> | | + IwbFileHeader</p>
<p> | | + IwbRecord</p>
<p> | | + <a href="#IwbGroupRecord">IwbGroupRecord</a></p>
<p> | | + <a href="#IwbMainRecord">IwbMainRecord</a></p>
<p> | | + <a href="#IwbSubRecord">IwbSubRecord</a></p>
<p> | |</p>
<p> | + <a href="#IwbFile">IwbFile</a></p>
<p> |</p>
<p class="list-1">+ IwbContainerElementRef</p>
<p class="empty"> </p>
<p> <a href="#IwbResource">IwbResource</a></p>
<p> IwbResourceContainer</p>
<p class="list-3">+ IwbBA2File</p>
<p class="list-3">+ IwbBSAFile</p>
<p class="list-3">+ IwbFolder</p>
<p class="empty"> </p>
<p> Other Types Used but Unknown</p>
<p class="list-3">+ TwbDefType</p>
<p class="list-3">+ TwbElementState</p>
<p class="list-3">+ TwbElementType</p>
<p class="list-3">+ TwbGridCell</p>
<p class="list-3">+ TwbVector</p>
<p class="list-3">+ TwbFastStringList</p>
<p class="list-3">+ TGameResourceType</p>
<p class="empty"> </p>
<p> <a href="#Misc_functions">Misc functions</a></p>
<p class="list-3">+ <a href="#DDS_functions">DDS</a></p>
<p class="list-3">+ <a href="#NIF_functions">NIF</a></p>
<p class="empty"> </p>
<div>
<a href="#s_113" class="drkbtn">Previous Section</a>
<a href="#s_114" class="drkbtn">Top of this Group</a>
</div>
<p><!--/.level-nav--></p>
<div id="s_11-4-1"></div>
<h3 class="scriptHeader" id="Globalfunctions">13.6 - Global functions</h3>
<p>These functions can be called on anything and should return a meaningful result.</p>
<p class="empty"> </p>
<table class="scriptTable wontwrap">
<tr>
<th> Function </th>
<th> Returns </th>
<th> Arguments </th>
<th> Description </th>
</tr>
<tr>
<td><b>AddMessage</b></td>
<td></td>
<td> asMessage: string </td>
<td> Pushes a line to TES5Edit's Information tab. </td>
</tr>
<tr>
<td><b>Assigned</b></td>
<td> boolean</td>
<td> aeElement: IwbElement </td>
<td> An extension to Delphi's native <a href="http://www.delphibasics.co.uk/RTL.asp?Name=Assigned">Assigned</a> function: returns true if <i>aeElement</i> is not <i>Nil</i>, and returns false otherwise. </td>
</tr>
<tr>
<td><b>ObjectToElement</b></td>
<td> IInterface</td>
<td> akObject </td>
<td> 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. <code>ObjectToElement(myList.Items[0])</code>. </td>
</tr>
<tr>
<td><b>FileByIndex</b></td>
<td> IwbFile</td>
<td> aiFile: integer </td>
<td>Returns a file by index. 0 is Fallout4.esm, 1 is Fallout4.exe, 2 is DLC or first mod loaded. See also: <i>FileCount</i>. </td>
</tr>
<tr>
<td><b>FileByLoadOrder</b></td>
<td> IwbFile</td>
<td> aiLoadOrder: integer </td>
<td> Returns a file by load order. 0 is Fallout4.esm, 1 is DLC or first mod loaded. </td>
</tr>
<tr>
<td><b>FullPathToFilename</b></td>
<td> string</td>
<td> asFilename: string </td>
<td> Returns the full path to the filename <i>asFilename</i>. </td>
</tr>
<tr>
<td><b>EnableSkyrimSaveFormat</b></td>
<td></td>
<td> </td>
<td> As of xEdit 3.1.2, calling this function will corrupt saved plugins until xEdit is restarted. </td>
</tr>
<tr>
<td><b>GetRecordDefNames</b></td>
<td></td>
<td> akList: TStrings </td>
<td> Unverified: Modifies <i>akList</i> by adding entries based on the contents of the global <i>wbRecordDefs</i>. </td>
</tr>
<tr>
<td><b>wbFilterStrings</b></td>
<td></td>
<td> akListIn: TStrings;<br> akListOut: TStrings;<br> asFilter: String </td>
<td> Modifies <i>akListOut</i>, adding every entry in <i>akListIn</i> that contains the substring <i>asFilter</i>. </td>
</tr>
<tr>
<td><b>wbRemoveDuplicateStrings</b></td>
<td></td>
<td> akList: TStringList </td>
<td> Modifies <i>akList</i>, removing any duplicate entries that it contains. </td>
</tr>
</table>
<p class="empty"> </p>
<div>
<a href="#s_114" class="drkbtn">Previous Section</a>
<a href="#s_1141" class="drkbtn">Top of this Group</a>
</div>
<p><!--/.level-nav--></p>
<div id="s_11-4-2"></div>
<h3 class="scriptHeader" id="IwbElement">13.7 - IwbElement</h3>
<p>These functions can be called on any IwbElement IInterface.</p>
<p class="empty"> </p>
<table class="scriptTable wontwrap">
<tr>
<th> Function </th>
<th> Returns </th>
<th> Arguments </th>
<th> Description </th>
</tr>
<tr>
<td><b>BaseName</b></td>
<td> string</td>
<td> aeElement: IwbElement </td>
<td>Identical to <i>Name</i> except that it handles IwbFiles differently. <i>Name</i> will prepend a load order index (i.e. <code>[02] PluginName.esp</code>), while <i>BaseName</i> will not.</td>
</tr>
<p> <tr id="BeginUpdate"></p>
<td><b>BeginUpdate</b></td>
<td></td>
<td>aeElement: IwbElement</td>
<td>
<p>For use on container elements only when performing a lot of operations with it like adding/removing children elements in batch. Needs to be paired with <a href="#EndUpdate">EndUpdate</a></p>
<pre>
BeginUpdate(e);
try
// do things with e
finally
EndUpdate(e);
end;
</pre>
</td>
</tr>
<tr>
<td><b>BuildRef</b></td>
<td></td>
<td> aeElement: IwbElement </td>
<td>Builds reference information for the element and all of its descendants. Note that this function will run even if reference information has already been built.</td>
</tr>
<tr>
<td><b>CanContainFormIDs</b></td>
<td> boolean</td>
<td> aeElement: IwbElement </td>
<td>Guaranteed to return <i>True</i> if the element can contain FormIDs, but not guaranteed to return <i>False</i> if it can't. This accesses an internal property, <i>CanContainFormIDs</i>, which the internal implementation of <i>BuildRef</i> uses to skip processing certain descendant elements.</td>
</tr>
<tr>
<td><b>CanMoveDown</b></td>
<td> boolean</td>
<td> aeElement: IwbElement </td>
<td>Returns true if the element is part of an array and can be moved further down using <i>MoveDown</i>.</td>
</tr>
<tr>
<td><b>CanMoveUp</b></td>
<td> boolean</td>
<td> aeElement: IwbElement</td>
<td>Returns true if the element is part of an array and can be moved further up using <i>MoveUp</i>.</td>
</tr>
<tr>
<td><b>Check</b></td>
<td> string</td>
<td> aeElement: IwbElement </td>
<td>Returns the error message produced when the "Check for Errors" functionality is run on <i>aeElement</i>; or else an empty string if no error is found.</td>
</tr>
<tr>
<td><b>ClearElementState</b></td>
<td></td>
<td> aeElement: IwbElement;<br> aiState: TwbElementState</td>
<td>Manipulates the internal flags of an element, e.g. <code>ClearElementState(eElement, wsModified);</code>. See also: <I>GetElementState</I>, <I>SetElementState</I>.</td>
</tr>
<tr>
<td><b>ContainingMainRecord</b></td>
<td> IwbMainRecord</td>
<td> aeElement: IwbElement </td>
<td> Returns the main record that contains the element. </td>
</tr>
<tr>
<td><b>DefType</b></td>
<td> TwbDefType</td>
<td> aeElement: IwbElement </td>
<td> Returns the def-type of the element. </td>
</tr>
<tr>
<td><b>DisplayName</b></td>
<td> string</td>
<td> aeElement: IwbElement </td>
<td>Returns the display name of the element, if it has one; otherwise, this behaves identically to <i>Name</i>. See also: <i>BaseName</i>, <i>ShortName</i>.</td>
</tr>
<tr>
<td><b>ElementAssign</b></td>
<td> IwbElement</td>
<td>aeContainer: IwbContainer;<br> aiIndex: integer;<br> aeSource: IwbElement;<br> abOnlySK: boolean</td>
<td>
<p> Copy the contents of one element into a container element, or create and append an element to a container.</p>
<p> <dl></p>
<p> <dt>aeContainer</dt></p>
<p> <dd>Destination element.</dd></p>
<p> <dt>aiIndex</dt></p>
<p> <dd>Where to place the new element, if the destination is an array. Specify <i>HighInteger</i> to append. Specify <i>LowInteger</i> or a negative value to add to non-arrays.</dd></p>
<p> <dt>aeSource</dt></p>
<p> <dd>Element to copy from. Use <i>Nil</i> to create a blank element of the appropriate type.</dd></p>
<p> <dt>abOnlySK</dt></p>
<p> <dd>Sorted Key Only; : Only apply to elements participating in container sorting, for internal xEdit usage. Use False.</dd></p>
<p> </dl></p>
<p>Sample: there is a script to copy VMAD subrecords "Skyrim - Copy VMAD subrecord.pas"</p>
</td>
</tr>
<tr>
<td><b>ElementType</b></td>
<td> TwbElementType</td>
<td> aeElement: IwbElement </td>
<td>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. </td>
</tr>
<p> <tr id="EndUpdate"></p>
<td><b>EndUpdate</b></td>
<td></td>
<td>aeElement: IwbElement</td>
<td>
<p>For use on container elements only when performing a lot of operations with it like adding/removing children elements in batch. Needs to be paired with <a href="#BeginUpdate">BeginUpdate</a></p>
<pre>
BeginUpdate(e);
try
// do things with e
finally
EndUpdate(e);
end;
</pre>
</td>
</tr>
<tr>
<td><b>EnumValues</b></td>
<td> string</td>
<td> aeElement: IwbElement </td>
<td>If <i>aeElement</i> is a set of named enum values, this function returns the names of any values that have been set, separated with spaces.</td>
</tr>
<tr>
<td><b>Equals</b></td>
<td> boolean</td>
<td> aeElement1: IwbElement;<br> aeElement2: IwbElement </td>
<td>Compares two elements by their ElementID. This is sometimes necessary, as different IInterface variables pointing to the same element don't always compare properly when using the <code>=</code> operator.</td>
</tr>
<tr>
<td><b>FlagValues</b></td>
<td> string</td>
<td> aeElement: IwbElement </td>
<td>If <i>aeElement</i> is a set of flags, this function returns the names of all set flags, separated with spaces.</td>
</tr>
<tr>
<td><b>FullPath</b></td>
<td> string</td>
<td> aeElement: IwbElement </td>
<td>Returns the full path to the element, going all the way down to its containing file. See also: <i>Path</i>, <i>PathName</i>.</td>
</tr>
<tr>
<td><b>GetContainer</b></td>
<td> IwbContainer</td>
<td> aeElement: IwbElement </td>
<td>Returns the element's container.</td>
</tr>
<tr>
<td><b>GetEditValue</b></td>
<td> string</td>
<td> aeElement: IwbElement </td>
<td>Returns a string representation of the element's value. See also: <i>SetEditValue</i>, <i>GetElementEditValues</i>, <i>SetElementEditValues</i>.</td>
</tr>
<tr>
<td><b>GetElementState</b></td>
<td> TwbElementState</td>
<td> aeElement: IwbElement;<br> aiState: TwbElementState </td>
<td>Checks the internal flags of an element. See also: <i>ClearElementState</i>, <i>SetElementState</i>.</td>
</tr>
<tr>
<td><b>GetFile</b></td>
<td> IwbFile</td>
<td> aeElement: IwbElement </td>
<td>Returns the file that contains the element.</td>
</tr>
<tr>
<td><b>GetNativeValue</b></td>
<td> variant</td>
<td> aeElement: IwbElement </td>
<td>Returns the element's value. See also: <i>SetNativeValue</i>, <i>GetElementNativeValues</i>, <i>SetElementNativeValues</i>.</td>
</tr>
<tr>
<td><b>IsEditable</b></td>
<td> boolean</td>
<td> aeElement: IwbElement </td>
<td>Returns true if the record can be edited. In some cases, xEdit will block edits to files like Skyrim.esm.</td>
</tr>
<tr>
<td><b>IsInjected</b></td>
<td> boolean</td>
<td> aeElement: IwbElement </td>
<td> Returns true if the element is an injected record. </td>
</tr>
<tr>
<td><b>LinksTo</b></td>
<td> IwbElement</td>
<td> aeElement: IwbElement </td>
<td>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).</td>
</tr>
<tr>
<td><b>MarkModifiedRecursive</b></td>
<td></td>
<td> aeElement: IwbElement </td>
<td>Marks the element and all of its descendants as modified. This forces xEdit to serialize them.</td>
</tr>
<tr>
<td><b>MoveDown</b></td>
<td></td>
<td> aeElement: IwbElement </td>
<td>If the element is part of an array, this function moves it down by one slot. See also: <i>CanMoveDown</i>.</td>
</tr>
<tr>
<td><b>MoveUp</b></td>
<td></td>
<td> aeElement: IwbElement </td>
<td>If the element is part of an array, this function moves it up by one slot. See also: <i>CanMoveUp</i>.</td>
</tr>
<tr>
<td><b>Name</b></td>
<td> string</td>
<td> aeElement: IwbElement </td>
<td>Returns the name of the element, if it has one. If <i>aeElement</i> is an IwbFile or certain linds of IwbMainRecords, <i>Name</i> will return a "pretty" name, while <i>BaseName</i> or <i>ShortName</i> will return a more basic string. See also: <i>DisplayName</i>.</td>
</tr>
<tr>
<td><b>Path</b></td>
<td> string</td>
<td> aeElement: IwbElement </td>
<td>Returns the <i>path component</i> of <i>aeElement</i> — that is, <i>one single piece</i> of the path that <i>FullPath</i> would return. You could use this when manually constructing a path to supply to <i>ElementByPath</i>. See also (and don't confuse with): <i>FullPath</i>, <i>PathName</i>.</td>
</tr>
<tr>
<td><b>PathName</b></td>
<td> string</td>
<td> aeElement: IwbElement </td>
<td>
<p>Similar to <i>FullPath</i> except that names in the path are prefixed with brackets, to uniquely identify each element's unique position among its siblings (see <i>IndexOf</i>).</p>
<p>Example: <code>\[02] neromancer.esp\[7] Worldspace\[1] World Children\[1] Children of 00000D74\[0] Persistent\[2] [REFR:00100452]</code></p>
</td>
</tr>
<tr>
<td><b>Remove</b></td>
<td></td>
<td> aeElement: IwbElement </td>
<td> Removes the element from its file. </td>
</tr>
<tr>
<td><b>ReportRequiredMasters</b></td>
<td></td>
<td> aeElement: IwbElement;<br> akListOut: TStrings;<br> akUnknown1: boolean;<br> akUnknown2: boolean </td>
<td>Checks which master files <i>aeElement</i> depends on, and adds their filenames to <i>akListOut</i>. First boolean is Recursive to go over children elements if it is a container, second is Initial which is false by default. </td>
</tr>
<tr>
<td><b>SetEditValue</b></td>
<td> string</td>
<td> aeElement: IwbElement;<br> asValue: string </td>
<td>Sets the element's value to one that matches the string representation passed in. See also: <i>GetEditValue</i>, <i>GetElementEditValues</i>, <i>SetElementEditValues</i>. </td>
</tr>
<tr>
<td><b>SetElementState</b></td>
<td> TwbElementState</td>
<td> aeElement: IwbElement;<br> aiState: TwbElementState </td>
<td>Manipulates the internal flags of an element. Returns the value prior to modification. See also: <i>ClearElementState</i>, <i>GetElementState</i>.</td>
</tr>
<tr>
<td><b>SetNativeValue</b></td>
<td> string</td>
<td> aeElement: IwbElement;<br> avValue: variant </td>
<td>Sets the element's value. See also: <i>GetNativeValue</i>, <i>GetElementNativeValues</i>, <i>SetElementNativeValues</i>.</td>
</tr>
<tr>
<td><b>SetToDefault</b></td>
<td></td>
<td> aeElement: IwbElement </td>
<td>Resets the element's data and adds missing fields if any</td>
</tr>
<tr>
<td><b>ShortName</b></td>
<td> string</td>
<td> aeElement: IwbElement </td>
<td>Generally the same as <i>Name</i> unless <i>aeElement</i> is a reference, cell, or similar record. <i>Name</i> will return detailed information for those records, while <i>ShortName</i> will return the signature and FormID in the format <code>[XXXX:01234567]</code>. </td>
</tr>
<tr>
<td><b>SortKey</b></td>
<td> string</td>
<td> aeElement: IwbElement </td>
<td>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. </td>
</tr>
<tr>
<td><b>wbCopyElementToFile</b></td>
<td> IwbElement</td>
<td> aeElement: IwbElement;<br> aeFile: IwbFile;<br> abAsNew: boolean;<br> abDeepCopy: boolean </td>
<td>Copies an IwbMainRecord, IwbGroupRecord, or IwbContainer to the specified file. The <i>abAsNew</i> boolean controls whether or not you're copying the record as an override record. Returns the copied element. </td>
</tr>
<tr>
<td><b>wbCopyElementToFileWithPrefix</b></td>
<td> IwbElement</td>
<td>aeElement: IwbElement;<br> aeFile: IwbFile;<br> abAsNew: boolean;<br> abDeepCopy: boolean;<br> aPrefixRemove;<br> aPrefix;<br> aSuffix: string</td>
<td>Details unknown. Returns the copied element.</td>
</tr>
<tr>
<td><b>wbCopyElementToRecord</b></td>
<td> IwbElement</td>
<td>aeElement: IwbElement;<br> aeRecord: IwbMainRecord;<br> abAsNew: boolean;<br> abDeepCopy: boolean</td>
<td>Copies an element to a record, e.g. the "Conditions" element on a <a href="https://www.creationkit.com/index.php?title=Constructible_Object">Constructible Object (COBJ)</a> record or a faction from an <a href="https://www.creationkit.com/index.php?title=ActorBase">ActorBase (NPC_)</a> record. Returns the copied element.</td>
</tr>
</table>
<p class="empty"> </p>
<div>
<a href="#s_1141" class="drkbtn">Previous Section</a>
<a href="#s_1142" class="drkbtn">Top of this Group</a>
</div>
<p><!--/.level-nav--></p>
<div id="s_11-4-3"></div>
<h3 class="scriptHeader" id="IwbContainer">13.8 - IwbContainer</h3>
<table class="scriptTable wontwrap">
<tr>
<th> Function </th>
<th> Returns </th>
<th> Arguments </th>
<th> Description </th>
</tr>
<tr>
<td><b>Add</b></td>
<td> IwbElement</td>
<td> aeContainer: IwbContainer;<br> asNameOrSignature: string;<br> abSilent: boolean </td>
<td>Creates a child element with the name-or-signature <i>asNameOrSignature</i> in <i>aeContainer</i> if no such child already exists; otherwise, marks the existing child as modified. Returns the created or existing element.</td>
</tr>
<tr>
<td><b>AddElement</b></td>
<td></td>
<td> aeContainer: IwbContainer;<br> aeElement: IwbElement </td>
<td>Adds <i>aeElement</i> as a child of <i>aeContainer</i>. Throws an error if <i>aeElement</i> already has a container.</td>
</tr>
<tr>
<td><b>AdditionalElementCount</b></td>
<td> integer</td>
<td> aeContainer: IwbContainer </td>
<td>Returns the number of "fake" elements xEdit adds before the "Record Header". For references it shows "Cell" for example. This getter accesses an internal function used internally for imposing some order on the sub-elements; it checks whether this element "counts," and if so, how many times. Seems to return 1 or 2 for (main?) records, and 0 for record fields (sub-records).</td>
</tr>
<tr>
<td><b>ContainerStates</b></td>
<td> byte</td>
<td> aeContainer: IwbContainer </td>
<td>Returns the internal container flags for <i>aeContainer</i> (e.g. whether it's initialized, or whether it has had references built) as a bitmask. Refer to "Worldspace browser.pas" for a usage example.</td>
</tr>
<tr>
<td><b>ElementByIndex</b></td>
<td> IwbElement</td>
<td> aeContainer: IwbContainer;<br> aiIndex: integer </td>
<td>Returns the <i>aiIndex</i>-th child element in <i>aeContainer</i>. See also: <i>ElementCount</i>.</td>
</tr>
<tr>
<td><b>ElementByName</b></td>
<td> IwbElement</td>
<td> aeContainer: IwbContainer;<br> asName: string </td>
<td>Searches <i>aeContainer</i> for the child element with name <i>asName</i>, and returns the found element or <i>Nil</i>. See also: <i>ElementExists</i>.</td>
</tr>
<tr>
<td><b>ElementByPath</b></td>
<td> IwbElement</td>
<td> aeContainer: IwbContainer;<br> asPath: string </td>
<td>Searches <i>aeContainer</i> for the descendant element specified by path <i>asPath</i>, and returns the found element or <i>Nil</i>.</td>
</tr>
<tr>
<td><b>ElementBySignature</b></td>
<td> IwbElement</td>
<td> aeContainer: IwbContainer;<br> asSignature: string </td>
<td>Searches <i>aeContainer</i> for the child element with signature <i>asSignature</i>, and returns the found element or <i>Nil</i>.</td>
</tr>
<tr>
<td><b>ElementCount</b></td>
<td> integer</td>
<td> aeContainer: IwbContainer </td>
<td>Returns the number of child elements in <i>aeContainer</i>. See also: <i>ElementByIndex</i>.</td>
</tr>
<tr>
<td><b>ElementExists</b></td>
<td> boolean</td>
<td> aeContainer: IwbContainer;<br> asName: string </td>
<td>Returns true if <i>aeContainer</i> as a child element whose name is <i>asName</i>. See also: <i>ElementByName</i>.</td>
</tr>
<tr>
<td><b>GetElementEditValues</b></td>
<td> string</td>
<td> aeContainer: IwbContainer;<br> asPath: string </td>
<td>Finds the element within <i>aeContainer</i> specified by <i>asPath</i>, and returns a string representation of its value.</td>
</tr>
<tr>
<td><b>GetElementNativeValues</b></td>
<td> variant</td>
<td> aeContainer: IwbContainer;<br> asPath: string </td>
<td>Finds the element within <i>aeContainer</i> specified by <i>asPath</i>, and returns its value.</td>
</tr>
<tr>
<td><b>IndexOf</b></td>
<td> integer</td>
<td> aeContainer: IwbContainer;<br> aeChild: IwbElement </td>
<td>Returns the index of <i>aeChild</i> in <i>aeContainer</i>, or -1 if <i>aeChild</i> is not a child element of <i>aeContainer</i>.</td>
</tr>
<tr>
<td><b>InsertElement</b></td>
<td></td>
<td> aeContainer: IwbContainer;<br> aiPosition: Integer;<br> aeElement: IwbElement </td>
<td>Inserts <i>aeElement</i> as a child of <i>aeContainer</i> at the specified position.</td>
</tr>
<tr>
<td><b>IsSorted</b></td>
<td> boolean</td>
<td> aeContainer: IwbSortableContainer </td>
<td>Checks whether xEdit always keeps <i>aeContainer</i> sorted. If so, this function will return <i>True</i>, and calling <i>CanMoveUp</i> and <i>CanMoveDown</i> on child elements will always return <i>False</i>.</td>
</tr>
<tr>
<td><b>LastElement</b></td>
<td> IwbElement</td>
<td> aeContainer: IwbContainer </td>
<td>Returns the last child element in <i>aeContainer</i>, or <i>Nil</i> if there are no child elements.</td>
</tr>
<tr>
<td><b>RemoveByIndex</b></td>
<td> IwbElement</td>
<td> aeContainer: IwbContainer;<br> aiIndex: integer;<br> abMarkModified: boolean </td>
<td>Removes the <i>aiIndex</i>-th child from <i>aeContainer</i>, and returns it.</td>
</tr>
<tr>
<td><b>RemoveElement</b></td>
<td> IwbElement</td>
<td> aeContainer: IwbContainer;<br> avChild: variant </td>
<td>Removes <i>avChild</i> from <i>aeContainer</i> and returns the removed element. The <i>avChild</i> argument can be: the index of an element to remove from an array container; the mame or signature of an element to remove; or an IwbElement to remove.</td>
</tr>
<tr>
<td><b>ReverseElements</b></td>
<td></td>
<td> aeContainer: IwbContainer </td>
<td>Reverses the order of the child elements in <i>aeContainer</i>.</td>
</tr>
<tr>
<td><b>SetElementEditValues</b></td>
<td></td>
<td> aeContainer: IwbContainer;<br> asPath: string;<br> asValue: string </td>
<td>Finds the element within <i>aeContainer</i> specified by <i>asPath</i>, and sets its value based on the string representation <i>asValue</i>.</td>
</tr>
<tr>
<td><b>SetElementNativeValues</b></td>
<td></td>
<td> aeContainer: IwbContainer;<br/> asPath: string;<br/> asValue: variant </td>
<td>Finds the element within <i>aeContainer</i> specified by <i>asPath</i>, and sets its value to <i>asValue</i>.,/td>
</tr>
</table>
<p class="empty"> </p>
<div>
<a href="#s_1142" class="drkbtn">Previous Section</a>
<a href="#s_1143" class="drkbtn">Top of this Group</a>
</div>
<p><!--/.level-nav--></p>
<div id="s_11-4-4"></div>
<h3 class="scriptHeader" id="IwbFile">13.9 - IwbFile</h3>
<table class="scriptTable wontwrap">
<tr>
<th> Function </th>
<th> Returns </th>
<th> Arguments </th>
<th> Description </th>
</tr>
<tr>
<td><b>AddMasterIfMissing</b></td>
<td></td>
<td> aeFile: IwbFile;<br> asMasterFilename: string </td>
<td> Adds the specified file as a master for <i>aeFile</i>, if it isn't already a master. </td>
</tr>
<tr>
<td><b>AddNewFileName</b></td>
<td> aeFile: IwbFile</td>
<td> FileName: String <br> (optional) ESLFlag: Boolean <br> </td>
<td>Creates a new, empty plugin using FileName as the name in the game's plugin folder (Data) and adds it to the end of the plugins list. if applicable, the ESL flag can be set.</td>
</tr>
<tr>
<td><b>AddNewFile</b></td>
<td> aeFile: IwbFile</td>
<td> (optional) ESLFlag: Boolean <br> </td>
<td>Creates a new, empty plugin in the game's plugin folder (Data) and adds it to the end of the plugins list. if applicable, the ESL flag can be set.</td>
</tr>
<tr>
<td><b>CleanMasters</b></td>
<td></td>
<td> aeFile: IwbFile </td>
<td>Appears to find unnecessary files in <i>aeFile</i>'s master list and remove them, updating all form indices accordingly. Don't confuse this within "cleaning master files" as in "removing ITMs and UDRs from official DLCs." This function is used in "Skyrim - Book Covers Patch.pas". </td>
</tr>
<tr>
<td><b>FileFormIDtoLoadOrderFormID</b></td>
<td> cardinal</td>
<td> aeFile: IwbFile; aiFormID: cardinal </td>
<td> Converts <i>aiFormID</i> from a FormID relative to <i>aeFile</i>'s master list (like that returned by <i>FixedFormID</i>) to a load order-relative FormID (like that returned by <i>FormID</i>). See also: <i>LoadOrderFormIDtoFileFormID</i>. </td>
</tr>
<tr>
<td><b>FileWriteToStream</b></td>
<td></td>
<td> aeFile: IwbFile;<br> akOutStream: TStream </td>
<td> Writes the contents of <i>aeFile</i> to <i>akOutStream</i>. Used in "SaveAs.pas" to allow a user to save a loaded file under a new name; that script creates a TFileStream object and uses this function to write to it. </td>
</tr>
<tr>
<td><b>GetFileName</b></td>
<td> string</td>
<td> aeFile: IwbFile </td>
<td> Returns <i>aeFile</i>'s filename. </td>
</tr>
<tr>
<td><b>GetIsESM</b></td>
<td> boolean</td>
<td> aeFile: IwbFile </td>
<td> Returns <i>True</i> if <i>aeFile</i> is flagged as an ESM. See also: <i>SetIsESM</i>. </td>
</tr>
<tr>
<td><b>GetLoadOrder</b></td>
<td> integer</td>
<td> aeFile: IwbFile </td>
<td> Returns <i>aeFile</i>'s index in the load order, or -1 if called on something that is not an IwbFile. </td>
</tr>
<tr>
<td><b>GetNewFormID</b></td>
<td> cardinal</td>
<td> aeFile: IwbFile </td>
<td> Returns a new FormID, the same way that <code>Add(..., ..., True)</code> does. </td>
</tr>
<tr>
<td><b>GroupBySignature</b></td>
<td> IwbGroupRecord</td>
<td> aeFile: IwbFile;<br> asSignature: string </td>
<td> If <i>aeFile</i> has a top-level group with the specified signature, that group is returned. </td>
</tr>
<tr>
<td><b>HasGroup</b></td>
<td> boolean</td>
<td> aeFile: IwbFile;<br> asSignature: string </td>
<td> Returns <i>True</i> if <i>aeFile</i> contains a top-level group with the specified signature. </td>
</tr>
<tr>
<td><b>HasMaster</b></td>
<td> boolean</td>
<td> aeFile: IwbFile;<br> asMasterFilename: string </td>
<td> Returns <i>True</i> if <i>aeFile</i> has a file with the name <i>asMasterFilename</i> as a master. </td>
</tr>
<tr>
<td><b>LoadOrderFormIDtoFileFormID</b></td>
<td> cardinal</td>
<td> aeFile: IwbFile; aiFormID: cardinal </td>
<td> Converts <i>aiFormID</i> from a load order-relative FormID (like that returned by <i>FormID</i>) to a FormID relative to <i>aeFile</i>'s master list (like that returned by <i>FixedFormID</i>). See also: <i>FileFormIDtoLoadOrderFormID</i>. </td>
</tr>
<tr>
<td><b>MasterByIndex</b></td>
<td> IwbFile</td>
<td> aeFile: IwbFile;<br> aiIndex: integer </td>
<td> Returns the <i>aiIndex</i>-th master file for <i>aeFile</i>. </td>
</tr>
<tr>
<td><b>MasterCount</b></td>
<td> cardinal</td>
<td> aeFile: IwbFile </td>
<td> Returns the number of master files that <i>aeFile</i> has. </td>
</tr>
<tr>
<td><b>RecordByEditorID</b></td>
<td> IwbMainRecord</td>
<td> aeFile: IwbFile;<br> asEditorID: string </td>
<td> Returns the <a href="https://www.creationkit.com/index.php?title=Magic_Effect">Magic Effect (MGEF)</a> or <a href="https://www.creationkit.com/index.php?title=Category:Settings">Setting (GMST)</a> record in <i>aeFile</i> that has the specified EditorID. For all other record types, use something like <code>MainRecordByEditorID(GroupBySignature(f, 'ECZN'), 'RandomEncounterZone1')</code>. </td>
</tr>
<tr>
<td><b>RecordByFormID</b></td>
<td> IwbMainRecord</td>
<td> aeFile: IwbFile;<br> aiFormID: integer;<br> abAllowInjected: boolean </td>
<td> Returns the main record in <i>aeFile</i> that has the specified FormID, or <i>Nil</i> if no records match. The FormID must be local to the file (see <i>FixedFormID</i>). </td>
</tr>
<tr>
<td><b>RecordByIndex</b></td>
<td> IwbMainRecord</td>
<td> aeFile: IwbFile;<br> aiIndex: integer </td>
<td> Returns the <i>aiIndex</i>-th record in <i>aeFile</i>. </td>
</tr>
<tr>
<td><b>RecordCount</b></td>
<td> cardinal</td>
<td> aeFile: IwbFile </td>
<td> Returns the number of records that <i>aeFile</i> has. </td>
</tr>
<tr>
<td><b>SetIsESM</b></td>
<td></td>
<td> aeFile: IwbFile;<br> abFlag: boolean </td>
<td> Modifies the ESM flag for <i>aeFile</i>. See also: <i>GetIsESM</i>. </td>
</tr>
<tr>
<td><b>SortMasters</b></td>
<td></td>
<td> aeFile: IwbFile </td>
<td> Attempts to sort the masters for <i>aeFile</i> by their place in the current load order. </td>
</tr>
</table>
<p class="empty"> </p>
<div>
<a href="#s_1143" class="drkbtn">Previous Section</a>
<a href="#s_1144" class="drkbtn">Top of this Group</a>
</div>
<p><!--/.level-nav--></p>
<div id="s_11-4-5"></div>
<h3 class="scriptHeader" id="IwbMainRecord">13.10 - IwbMainRecord</h3>
<table class="scriptTable wontwrap">
<tr>
<th> Function </th>
<th> Returns </th>
<th> Arguments </th>
<th> Description </th>
</tr>
<tr>
<td><b>BaseRecord</b></td>
<td> IwbMainRecord</td>
<td> aeRecord: IwbMainRecord </td>
<td> If <i>aeRecord</i> is a <a href="https://www.creationkit.com/index.php?title=Reference">Reference</a>, this function returns the IwbMainRecord of its base form. Otherwise, the function returns <i>Nil</i>. </td>
</tr>
<tr>
<td><b>BaseRecordID</b></td>
<td> cardinal</td>
<td> aeRecord: IwbMainRecord </td>
<td> Appears to return the load order-relative FormID of <i>aeRecord</i>. </td>
</tr>
<tr>
<td><b>ChangeFormSignature</b></td>
<td></td>
<td> aeRecord: IwbMainRecord;<br> asNewSignature: string </td>
<td> Changes <i>aeRecord</i>'s signature to <i>asNewSignature</i>. No other information is modified. </td>
</tr>
<tr>
<td><b>ChildGroup</b></td>
<td> IwbGroupRecord</td>
<td> aeRecord: IwbMainRecord </td>
<td>Returns the group that <i>aeRecord</i> contains, if any. For example, a <a href="https://www.creationkit.com/index.php?title=Worldspace">Worldspace(WRLD)</a> record will be followed by a GRUP containing the worldspace's <a href="https://www.creationkit.com/index.php?title=Cell">Cell (CELLs)</a>, and you would use this function to retrieve that group. </td>
</tr>
<tr>
<td><b>CompareExchangeFormID</b></td>
<td> boolean</td>
<td> aeRecord: IwbMainRecord;<br> aiOldFormID: cardinal;<br> aiNewFormID: cardinal </td>
<td> Attempts to change <i>aeRecord</i>'s FormID from <i>aiOldFormID</i> to <i>aiNewFormID</i>, and returns <i>True</i> if the operation succeeds. </td>
</tr>
<tr>
<td><b>EditorID</b></td>
<td> string</td>
<td> aeRecord: IwbMainRecord </td>
<td> Returns the record's EditorID. </td>
</tr>
<tr>
<td><b>FixedFormID</b></td>
<td> cardinal</td>
<td> aeRecord: IwbMainRecord </td>
<td> Returns the local FormID of the record. Local records will not have a load order prefix (i.e. 0x00FFFFFF), and overrides will have a prefix relative to the record's file's masters. See also: <i>FormID</i>, <i>GetLoadOrderFormID</i>. </td>
</tr>
<tr>
<td><b>FormID</b></td>
<td> cardinal</td>
<td> aeRecord: IwbMainRecord </td>
<td> Returns the record's FormID. See also: <i>FixedFormID</i>, <i>GetLoadOrderFormID</i>. </td>
</tr>
<tr>
<td><b>GetFormVCS1</b></td>
<td> cardinal</td>
<td> aeRecord: IwbMainRecord </td>
<td> Returns the value of the Version Control Info 1 field. See also: <i>SetFormVCS1</i>. </td>
</tr>
<tr>
<td><b>GetFormVCS2</b></td>
<td> cardinal</td>
<td> aeRecord: IwbMainRecord </td>
<td> Returns the value of the Version Control Info 2 field. See also: <i>SetFormVCS2</i>. </td>
</tr>
<tr>
<td><b>GetFormVersion</b></td>
<td> cardinal</td>
<td> aeRecord: IwbMainRecord </td>
<td> Get Form Version field from the record's header. See also: <i>SetFormVersion</i>. </td>
</tr>
<tr>
<td><b>GetGridCell</b></td>
<td> TwbGridCell</td>
<td> aeRecord: IwbMainRecord </td>
<td> If <i>aeRecord</i> is an exterior <a href="https://www.creationkit.com/index.php?title=Cell">Cell (CELL)</a>, this function will return its grid coordinates as a TwbGridCell; you can access the coordinates by checking <code>returnValue.x</code> and <code>returnValue.y</code>. </td>
</tr>
<tr>
<td><b>GetIsDeleted</b></td>
<td> boolean</td>
<td> aeRecord: IwbMainRecord </td>
<td> Checks the record's "deleted" flag. See also: <i>SetIsDeleted</i>. </td>
</tr>
<tr>
<td><b>GetIsInitiallyDisabled</b></td>
<td> boolean</td>
<td> aeRecord: IwbMainRecord </td>
<td> Checks the record's "initially disabled" flag. See also: <i>SetIsInitiallyDisabled</i>. </td>
</tr>
<tr>
<td><b>GetIsPersistent</b></td>