Jump to content

Using a FormList in the Script


DosMike

Recommended Posts

Hi, I'm new to Skyrim modding and I'm currently writing a private test mod to see what I could do with the CK.

I came up with the Idea for a NPC to take ruined and burned books and "convert" them into e.g. common books using a Quest.

 

Now I'm currently stuck with the queststage to take five (ruined/burnt) books (next stage would be wait, then giving the result)

 

This is the code I'm using in my Dialog (pretty much copy/paste from the ck wiki)

 

int ListSize = dmm_JosRuinedBooks.GetSize()
int ListIndex = 0
int ItemsLeft = 5
while ListIndex <= ListSize && ItemsLeft > 0
    Form CurrentItem = dmm_JosRuinedBooks.GetAt(ListIndex)
    int ItemCount = Game.getPlayer().GetItemCount(CurrentItem)
 
    Game.getPlayer().RemoveItem(CurrentItem, ItemCount)
    ItemsLeft -= ItemCount
    ListIndex += 1
endwhile

GetowningQuest().SetStage(20)
And I get those Errors on Compile:

 

(9,15): variable dmm_JosRuinedBooks is undefined

(9,34): none is not a known user-defined type

(9,4): type mismatch while assigning to a int (cast missing or types unrelated)

(13,23): variable dmm_JosRuinedBooks is undefined

(13,42): none is not a known user-defined type

 

dmm_JosRuinedBooks is an Element of Object Window > Misc > FormList and I currently got no idea how to really use it in this script

Link to comment
Share on other sites

You need to create a FormList property and point it to that FormList. However with fragments like this, you cannot add the property until the script exists and you cannot put the code in until the property exists. To that end:

 

Put this in the fragment window

 

;place holder

Compile the script

Exit all forms back to the basic CK setup, then re-open back to your dialog.

 

Not familiar with the dialog forms, but there should be somewhere listed a script box that will have a new script listed. Highlight that script and press the properties button. A new window appears. Click the Add Property button and in the new window that appears fill out the details for the property you want. In your case:

Type = FormList

Name = dmm_JosRuinedBooks

 

Then go back to the fragment and replace the commented place holder with your actual code. Finally compile again. At this point you should be able to test to see if it is doing what you want.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...