142
edits
DavidJCobb (talk | contribs) |
DavidJCobb (talk | contribs) |
||
Line 34: | Line 34: | ||
Suppose a script adds forms ''W'', ''X'', ''Y'', and ''Z'' to the FormList; however, forms ''W'' and ''X'' are forms that were created during play (e.g. ObjectReferences spawned via PlaceAtMe), while forms ''Y'' and ''Z'' are forms defined in the user's load order. The FormList will now contain: ''W X T U V Y Z''. | Suppose a script adds forms ''W'', ''X'', ''Y'', and ''Z'' to the FormList; however, forms ''W'' and ''X'' are forms that were created during play (e.g. ObjectReferences spawned via PlaceAtMe), while forms ''Y'' and ''Z'' are forms defined in the user's load order. The FormList will now contain: ''W X T U V Y Z''. | ||
One last detail. Suppose a FormList initially contains ''A'', ''B'', and ''C'', and a script adds ''D'', ''E'', ''F'', and ''G'' to it; the FormList therefore contains ''A B C D E F G''. Now, suppose the user saves the game and updates a mod, and the mod update adds ''G'' to the FormList. What happens? Does ''G'' end up in the list twice, and if not, which position does it use? Well, when the user loads the game, the FormList will be initialized to contain ''A B C G''; then, the script-added forms from the savedata will be imported into the list, avoiding duplicates (the same underlying function is used for this part of savedata loading as for the | One last detail. Suppose a FormList initially contains ''A'', ''B'', and ''C'', and a script adds ''D'', ''E'', ''F'', and ''G'' to it; the FormList therefore contains ''A B C D E F G''. Now, suppose the user saves the game and updates a mod, and the mod update adds ''G'' to the FormList. What happens? Does ''G'' end up in the list twice, and if not, which position does it use? Well, when the user loads the game, the FormList will be initialized to contain ''A B C G''; then, the script-added forms from the savedata will be imported into the list, avoiding duplicates (the same underlying function is used for this part of savedata loading as for the AddForm function itself). This means that the FormList will end up containing ''A B C G D E F''. | ||
Reverse-engineers should be aware that in memory, the list of non-temporary forms comes before the list of temporary forms; however, the underlying function for [[GetAt - FormList]] checks the latter first, treating the start of the latter as index 0. | Reverse-engineers should be aware that in memory, the list of non-temporary forms comes before the list of temporary forms; however, the underlying function for [[GetAt - FormList]] checks the latter first, treating the start of the latter as index 0. |
edits