Difference between revisions of "AddForm - FormList"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>DavidJCobb
(→‎Notes: list item order)
imported>DavidJCobb
(→‎Notes: ARGH)
Line 23: Line 23:


== Notes ==
== Notes ==
* Code analysis indicates that new forms are appended to a block at the start of the list. This is ''almost'' the same as adding them to the start of the list. If the Creation Kit defines a FormList with elements A and B, and you add elements C, D, and E in that order, then the expected list order based on disassembly of the executable would be ''C D E A B''.
* It is not clear where in the list the form will be added.
** Code analysis indicates that new forms are appended to a block at the start of the list. This is ''almost'' the same as adding them to the start of the list. If the Creation Kit defines a FormList with elements A and B, and you add elements C, D, and E in that order, then the expected list order based on disassembly of the executable would be ''C D E A B''.
** The same editor who performed that code analysis also ran a simple test in-game, adding three activators to a FormList that already contained two. The resulting order was ''A B C D E''.
* FormLists cannot contain duplicate entries. Using AddForm(...) with a form that is already in the list will not add a second copy to the list.
* FormLists cannot contain duplicate entries. Using AddForm(...) with a form that is already in the list will not add a second copy to the list.
* A created reference does not become persistent by virtue of being added to a FormList. If you try to retrieve the reference from the FormList when it is not loaded and not persistent, you will get an incorrect result or no result.
* A created reference does not become persistent by virtue of being added to a FormList. If you try to retrieve the reference from the FormList when it is not loaded and not persistent, you will get an incorrect result or no result.

Revision as of 15:08, 19 April 2019

Member of: FormList Script

Adds the given form to the form list.

Syntax

Function AddForm(Form apForm) native

Parameters

  • apForm: Form to add to the list, if apForm == None this function seems to have no effect

Return Value

None

Examples

; Adds the diamond to the gem list
GemList.AddForm(Diamond)

Notes

  • It is not clear where in the list the form will be added.
    • Code analysis indicates that new forms are appended to a block at the start of the list. This is almost the same as adding them to the start of the list. If the Creation Kit defines a FormList with elements A and B, and you add elements C, D, and E in that order, then the expected list order based on disassembly of the executable would be C D E A B.
    • The same editor who performed that code analysis also ran a simple test in-game, adding three activators to a FormList that already contained two. The resulting order was A B C D E.
  • FormLists cannot contain duplicate entries. Using AddForm(...) with a form that is already in the list will not add a second copy to the list.
  • A created reference does not become persistent by virtue of being added to a FormList. If you try to retrieve the reference from the FormList when it is not loaded and not persistent, you will get an incorrect result or no result.

See Also