dizietemblesssma Posted August 5, 2020 Share Posted August 5, 2020 I must not understand the syntax of the above function, here is my code: Formlist Function dz_get_kit(Actor aRef) Formlist ItemList ;temporary formlaist Form[] Items ;temporary array Items = PO3_SKSEFunctions.AddAllEquippedItemsToArray(aRef) ;fill array with equipped items ShowMessage("items = "+Items,False) ItemList.AddForms(Items) ;add temp array items to formlist ShowMessage("ItemList is "+ItemList,False) Return ItemList ;return items as a formlist EndFunction The temporary array 'Items' is filled and the debug 'showmessage' confirms that, but the following line:ShowMessage("ItemList is "+ItemList,False)always returns "itemlist is NONE". The SKSE version of Formlist.psc says:; Adds an Array of Forms to this listFunction AddForms(Form[] forms) native So it would seem I'm misinterpreting how to use it. diziet Link to comment Share on other sites More sharing options...
IsharaMeradin Posted August 6, 2020 Share Posted August 6, 2020 (edited) Try an actual FormList record. Create an empty FormList record and assign it to a property. Then you can utilize a function like this instead: FormList Property ItemList Auto Function dz_get_kit(Actor aRef) Form[] Items ;temporary array Items = PO3_SKSEFunctions.AddAllEquippedItemsToArray(aRef) ;fill array with equipped items ShowMessage("items = "+Items,False) ItemList.AddForms(Items) ShowMessage("ItemList is "+ItemList,False) EndFunction With any luck it will work. If it doesn't, then I'm just as clueless cause I've never used that function before. Edited August 6, 2020 by IsharaMeradin Link to comment Share on other sites More sharing options...
dizietemblesssma Posted August 6, 2020 Author Share Posted August 6, 2020 Try an actual FormList record. Create an empty FormList record and assign it to a property. Then you can utilize a function like this instead: With any luck it will work. If it doesn't, then I'm just as clueless cause I've never used that function before.I added the line:FormList Property ItemList Autoto the top of my script and in the CK the value of the property was 'NONE', is that correct? edited the function as you showed and no joy.seems I need a new way to add the array items to a formlist, diziet Link to comment Share on other sites More sharing options...
IsharaMeradin Posted August 6, 2020 Share Posted August 6, 2020 No, not correct. You need to actually create a formlist record, just leave the record itself empty. Assign said formlist record to the property. Link to comment Share on other sites More sharing options...
dizietemblesssma Posted August 6, 2020 Author Share Posted August 6, 2020 I am a bear of very little brain so please bear with me:) Do you mean create a new formlist record in the CK? diziet Link to comment Share on other sites More sharing options...
dizietemblesssma Posted August 6, 2020 Author Share Posted August 6, 2020 No, not correct. You need to actually create a formlist record, just leave the record itself empty. Assign said formlist record to the property.Ok that seems to work, my only concern is that now I have to make sure that the formlist defined as a property is empty each time the funtuion it is in runs, so I now have: Formlist Function dz_get_kit(Actor aRef) Formlist empty_formlist ;temporary formlist Itemlist = empty_formlist Form[] Items ;temporary array Items = PO3_SKSEFunctions.AddAllEquippedItemsToArray(aRef) ;fill array with equipped items ShowMessage("items = "+Items,False) ItemList.AddForms(Items) ;add temp array items to formlist ShowMessage("ItemList is "+ItemList,False) Return ItemList ;return items as a formlist EndFunction will:Formlist empty_formlist ;temporary formlistItemlist = empty_formlist be sufficient? diziet Link to comment Share on other sites More sharing options...
IsharaMeradin Posted August 6, 2020 Share Posted August 6, 2020 Just run Revert on the formlist. Revert removes all script added entries. Since the formlist is empty to begin with... see where I'm going with it? Like so: ItemList.Revert() Form[] Items ;temporary array Items = PO3_SKSEFunctions.AddAllEquippedItemsToArray(aRef) ;fill array with equipped items ShowMessage("items = "+Items,False) ItemList.AddForms(Items) ShowMessage("ItemList is "+ItemList,False) FYI - Unless your are calling the function from another script, you do not need make it return a formlist as you can use the property throughout the script as needed instead. Link to comment Share on other sites More sharing options...
dizietemblesssma Posted August 7, 2020 Author Share Posted August 7, 2020 Ah, thankyou very much. To echo another thread, I find this forum very helpful and friendly.:) diziet Link to comment Share on other sites More sharing options...
Recommended Posts