Jump to content

I need major scripting help with one function in my mod...


angelwraith

Recommended Posts

I don't know if there are any other problems in your scripts, but you're almost certainly running into a current bug with the FOSE ListRemoveForm/ListRemoveNthForm fuctions, because you're doing all your operations at the end of the lists. As I mentioned here, that bug is:

  • If ListRemoveForm or ListRemoveNthForm are used to remove the last entry in a FormList (that contains more than 1 entry), no more entries can be added to the end of the list.

I explain one method to avoid this bug here.

 

Even without this bug, unless you have some reason to do otherwise, you should do all your formlist operations at the head of the list when possible, since it's much more efficient. So you should change lines such as this:

 

ListAddForm SUBsortBigGunsList rBaseInvObj

to either of these:

ListAddForm SUBsortBigGunsList rBaseInvObj 0
AddFormToFormList SUBsortBigGunsList rBaseInvObj

...and to empty a formlist, do this:

label 1
if ListGetCount SUBsortAdvancedWeapList > 0
ListRemoveNthForm SUBsortAdvancedWeapList 0
goto 1
endif

 

If you need to remove arbitrary items from the formlist, you'll want to use the dummy-at-the-end method described in the post mentioned above so you'll avoid the bug caused by removing the last list item.

Link to comment
Share on other sites

I don't know if there are any other problems in your scripts, but you're almost certainly running into a current bug with the FOSE ListRemoveForm/ListRemoveNthForm fuctions, because you're doing all your operations at the end of the lists. As I mentioned here, that bug is:

  • If ListRemoveForm or ListRemoveNthForm are used to remove the last entry in a FormList (that contains more than 1 entry), no more entries can be added to the end of the list.

I explain one method to avoid this bug here.

 

Even without this bug, unless you have some reason to do otherwise, you should do all your formlist operations at the head of the list when possible, since it's much more efficient. So you should change lines such as this:

 

ListAddForm SUBsortBigGunsList rBaseInvObj

to either of these:

ListAddForm SUBsortBigGunsList rBaseInvObj 0
AddFormToFormList SUBsortBigGunsList rBaseInvObj

...and to empty a formlist, do this:

label 1
if ListGetCount SUBsortAdvancedWeapList > 0
ListRemoveNthForm SUBsortAdvancedWeapList 0
goto 1
endif

 

If you need to remove arbitrary items from the formlist, you'll want to use the dummy-at-the-end method described in the post mentioned above so you'll avoid the bug caused by removing the last list item.

 

 

WOW thats really quite helpful..

what i think this means for me is i need to flesh out the idea to replace forms from a copy..

 

that way i never hit 0

and also that way vanilla and masterfile items will always be sorted..

 

thank you very much!!!!

Link to comment
Share on other sites

No, there's no problem emptying a list (I assume that's what you mean by "hit 0"). I should probably rephrase this:

  • If ListRemoveForm or ListRemoveNthForm are used to remove the last entry in a FormList (that contains more than 1 entry), no more entries can be added to the end of the list.

last entry = entry at the end of the list, NOT a single remaining entry.

 

Again, the problem in the scripts you posted is that you're doing all your formlist operations (adding and removing) at the end of the lists. If you instead add and remove only at the head of the lists (index 0), your scripts will both be more efficient and avoid the bug.

Link to comment
Share on other sites

No, there's no problem emptying a list (I assume that's what you mean by "hit 0"). I should probably rephrase this:

  • If ListRemoveForm or ListRemoveNthForm are used to remove the last entry in a FormList (that contains more than 1 entry), no more entries can be added to the end of the list.

last entry = entry at the end of the list, NOT a single remaining entry.

 

Again, the problem in the scripts you posted is that you're doing all your formlist operations (adding and removing) at the end of the lists. If you instead add and remove only at the head of the lists (index 0), your scripts will both be more efficient and avoid the bug.

 

yeah i gots it now thanks soo much for your help!!

 

always workin at index 0 from now on!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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