Scripting Tutorial: Working with FormLists
This article is incomplete. You can help by filling in any blank descriptions. Further information might be found in a section of the discussion page. Please remove this message when no longer necessary. |
This article is a WIP. I'll try to finish it in the next few days.--Omzy 00:50, 1 August 2009 (UTC)
IMPORTANT
You will need Fallout_Script_Extender for this tutorial.
Introduction
With the development of the GECK came several new object types and functions that were not seen in previous versions of Bethesda's game construction kits. One of the new object types that was added is called a FormList. A FormList is, naturally, a list of FormIDs of objects from the editor.
FormLists were originally created to serve a variety of purposes (See FormList). The creators of FOSE developed a handful of new functions that allow easy script manipulation of FormLists. These functions made FormLists much more powerful, giving them the all the functionalities of the List programming construct found in almost all high level programming languages.
FormList Functions
This table shows all the FormList functions currently available to modders:
From the GECK | From FOSE |
---|---|
AddFormToFormList | ListAddForm |
IsInList | ListAddReference |
IsWeaponInList | ListRemoveForm |
ListRemoveNthForm | |
ListReplaceForm | |
ListReplaceNthForm | |
ListGetForm | |
ListGetNthForm | |
ListGetFormIndex | |
ListGetCount |
Modifying FormLists
- create a list: can you do this dynamically? (just create it in the editor first)
- adding forms to the list (which index do they start at if unspecified?)
- ListAddForm
- ref.ListAddReference
- removing forms from the list
- ListRemoveForm
- ListRemoveNthForm
- replacing forms in the list
- ListReplaceForm
- ListReplaceNthForm
- getting forms from the list
- ListGetForm
- ListGetNthForm
- getting form information
- ListGetFormIndex
- ListGetCount
Lists of Lists...What?
As it would seem, a FormList is also an object in the editor, which has its own FormID. That makes a FormList a Form. What this means is that FormLists can contain other FormLists. This may seem a bit confusing if you've never learned any mid-level programming before, so lets look at the following script and see what it does:
(script here)
(add more scripting tricks/uses)