HerrBaron Posted February 23, 2011 Share Posted February 23, 2011 Ok, here's the thing: I've got a form list I use as an exclusion list for RemoveAllTypedItems. It's a known issue with the form list functions in NVSE that deleting the last item in a form list will crash the game; this is NOT the case with persisten references, so it would appear that the form list issue is centered around base forms in form lists only. I populate the form list using GetHotKeyItem, which returns base forms, not references. Elsewhere in my project, I use form lists to temporarily store persistent references, added and removed all day long without any adverse effects. So here's what I'm thinking; since GetHotKeyItem returns base forms, is there any way you can think of to 'convert' a base form into a reference to an object temporarily, so that the form list methods will work reliably in this instance? I hope I've stated this clearly; any ideas on this? Thanks, guys! Link to comment Share on other sites More sharing options...
davidlallen Posted February 23, 2011 Share Posted February 23, 2011 Lots of related discussion here:http://forums.bethsoft.com/index.php?/topic/1165881-problems-with-a-couple-of-nvse-functions/See especially post #18 by rickerhk. Link to comment Share on other sites More sharing options...
rickerhk Posted February 23, 2011 Share Posted February 23, 2011 This may sound like a nutty workaround, but here goes: 1. Get the base object of the hotkeyed item - rBaseItemX2. set rhotkeyitemXRef to player.placeatme rBaseItemX 1 ;gives you a ref for the form list. 3. disable the ref if it needs to hang around for awhile and you don't want it visible4. Mark it for delete when done. Instead of the player, you could try placing stuff at a marker in a dummy cell. Link to comment Share on other sites More sharing options...
HerrBaron Posted February 23, 2011 Author Share Posted February 23, 2011 Lots of related discussion here:http://forums.bethso...nvse-functions/See especially post #18 by rickerhk. :biggrin: Thanks, David; that was my thread. Unfortunately, his approach may have worked in FOSE, but not in NVSE; believe this is a base form / form list issue, and I know that persistent references work just great with form lists... Link to comment Share on other sites More sharing options...
HerrBaron Posted February 23, 2011 Author Share Posted February 23, 2011 This may sound like a nutty workaround, but here goes: 1. Get the base object of the hotkeyed item - rBaseItemX2. set rhotkeyitemXRef to player.placeatme rBaseItemX 1 ;gives you a ref for the form list. 3. disable the ref if it needs to hang around for awhile and you don't want it visible4. Mark it for delete when done. Instead of the player, you could try placing stuff at a marker in a dummy cell. That's a great idea! I'll give that a shot! :smile: I'm so used to being able to new something up in compiled languages, that this has kind of been eluding me. Thanks, Ricker! Link to comment Share on other sites More sharing options...
davidlallen Posted February 23, 2011 Share Posted February 23, 2011 To be honest I am not able to understand your original post. You have a formlist say F1. You use the formlist as an exclusion list for removealltypeditems. The formlist has base objects on it, since it would not make sense to have references to objects on an exclusion list. You populate F1 using some base objects returned by GetHotKeyItem. You have some need to remove objects from F1, and you have found the problem that sometimes you remove all the objects from F1 and you get a (known) crash. What is the application for removing objects from F1? Can you add objects first, before removing? Can you check in advance if the list is about to become empty and just stop? Maybe you can come back later to remove that one object. If you are sure that you need a *persistent* object, then placeatme won't help; by definition these objects are not persistent. Link to comment Share on other sites More sharing options...
HerrBaron Posted February 23, 2011 Author Share Posted February 23, 2011 To be honest I am not able to understand your original post. You have a formlist say F1. You use the formlist as an exclusion list for removealltypeditems. The formlist has base objects on it, since it would not make sense to have references to objects on an exclusion list. You populate F1 using some base objects returned by GetHotKeyItem. You have some need to remove objects from F1, and you have found the problem that sometimes you remove all the objects from F1 and you get a (known) crash. What is the application for removing objects from F1? Can you add objects first, before removing? Can you check in advance if the list is about to become empty and just stop? Maybe you can come back later to remove that one object. If you are sure that you need a *persistent* object, then placeatme won't help; by definition these objects are not persistent. David, You understand perfectly. The reason it's necessary to clear the exclusion list is that if I don't, and the user changes hotkeyed items (weapons in this case), you end up with a continually growing savegame, a no-no! :) I'm just trying to find a workaround for an issue that does not seem to lend itself to easy solution, particularly after not getting responses to emails from the NVSE folks. I've even offered to help; I have all the tools and expertise needed. But even if I were to succeed in fixing the issue here, I certainly couldn't distribute it. As to the necessity of a persistent object reference, what Ricker suggests might work, in that the objects created by PlaceAtMe are, from the point of view of the game engine internals, instantiated objects, not simply types from which instances are created. We'll soon find out! :) Link to comment Share on other sites More sharing options...
davidlallen Posted February 23, 2011 Share Posted February 23, 2011 (edited) It seems that a user will change one hotkey at a time. So, if you copy the old formlist and compare it to the new formlist, there should only be one item different. So you could delete that one, and add one new. Would that work? In the case that the user has only one hotkey, and deletes it, you could detect this and add the new item before deleting the old one. Edited February 23, 2011 by davidlallen Link to comment Share on other sites More sharing options...
HerrBaron Posted February 23, 2011 Author Share Posted February 23, 2011 To be honest I am not able to understand your original post. You have a formlist say F1. You use the formlist as an exclusion list for removealltypeditems. The formlist has base objects on it, since it would not make sense to have references to objects on an exclusion list. You populate F1 using some base objects returned by GetHotKeyItem. You have some need to remove objects from F1, and you have found the problem that sometimes you remove all the objects from F1 and you get a (known) crash. What is the application for removing objects from F1? Can you add objects first, before removing? Can you check in advance if the list is about to become empty and just stop? Maybe you can come back later to remove that one object. If you are sure that you need a *persistent* object, then placeatme won't help; by definition these objects are not persistent. David, You understand perfectly. The reason it's necessary to clear the exclusion list is that if I don't, and the user changes hotkeyed items (weapons in this case), you end up with a continually growing savegame, a no-no! :) I'm just trying to find a workaround for an issue that does not seem to lend itself to easy solution, particularly after not getting responses to emails from the NVSE folks. I've even offered to help; I have all the tools and expertise needed. But even if I were to succeed in fixing the issue here, I certainly couldn't distribute it. As to the necessity of a persistent object reference, what Ricker suggests might work, in that the objects created by PlaceAtMe are, from the point of view of the game engine internals, instantiated objects, not simply types from which instances are created. We'll soon find out! :) I'm not sure how I would programmatically create a new form list? You can't PlaceAtMe with them, I don't think...? By the way, I wasn't disparaging the NVSE guys; I understand they're likely busy working stiffs like me, who out of pure generosity have created a wonderful tool for the community purely pro bono; God bless them! :) Link to comment Share on other sites More sharing options...
davidlallen Posted February 23, 2011 Share Posted February 23, 2011 You only need one form list as storage; declare it in your mod. Put one blank item in it as a placeholder as suggested by rickerhk in the bethsoft thread. Link to comment Share on other sites More sharing options...
Recommended Posts