Editing Scripting Tutorial: Working with FormLists

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 100: Line 100:
Let us create a [[FormList]] for each name that contains the letters of that name. The name of each list will be ''nameX'' where ''X'' is the name (e.g. ''nameCloud''). If we try dragging and dropping ''B, a, r, r, e, t'' into a FormList for the name Barret, we will not be able to add the second ''r'' because dragging and dropping allows us only to add base forms to a FormList once, since they have the same FormID. So, we must add the letters as references via a script using [[ListAddReference]] OR by placing the letters into the world in a cell somewhere and dragging their references from the Cell View window. For this example, lets assume we've added them to a test cell somewhere so we can use [[MoveTo]] to relocate them to their destinations. We will add the letters so that the first letter of each name is at index 0.
Let us create a [[FormList]] for each name that contains the letters of that name. The name of each list will be ''nameX'' where ''X'' is the name (e.g. ''nameCloud''). If we try dragging and dropping ''B, a, r, r, e, t'' into a FormList for the name Barret, we will not be able to add the second ''r'' because dragging and dropping allows us only to add base forms to a FormList once, since they have the same FormID. So, we must add the letters as references via a script using [[ListAddReference]] OR by placing the letters into the world in a cell somewhere and dragging their references from the Cell View window. For this example, lets assume we've added them to a test cell somewhere so we can use [[MoveTo]] to relocate them to their destinations. We will add the letters so that the first letter of each name is at index 0.


===Inefficient Script===
If we wish to print these names into the world somewhere, we can use the [[Label]]/[[GoTo]] loop, one loop for each FormList of letters:
If we wish to print these names into the world somewhere, we can use the [[Label]]/[[GoTo]] loop, one loop for each FormList of letters:
   scn floatingNamesScript
   scn floatingNamesScript
Line 165: Line 164:
The script was cut short because it is a bit tedious, since we have 9 names to print. The script could also quickly get long if we put more instructions into each loop, like angle and scale information.
The script was cut short because it is a bit tedious, since we have 9 names to print. The script could also quickly get long if we put more instructions into each loop, like angle and scale information.


===Lists of Lists===
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. Lets use this to our advantage by making another FormList named ''namesList''. Now we will drag and drop all 9 of our name FormLists into this new FormList. Our script just got a whole lot shorter:
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. Lets use this to our advantage by making another FormList named ''namesList''. Now we will drag and drop all 9 of our name FormLists into this new FormList.
 
===Efficient Script===
Our script just got a whole lot shorter:
   scn floatingNamesScript
   scn floatingNamesScript
   ;vars (not listed for brevity)
   ;vars (not listed for brevity)

Please note that all contributions to the Fallout3 GECK Wiki are considered to be released under the Creative Commons Attribution-ShareAlike (see GECK:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)