Difference between revisions of "Talk:RemoveAddedForm - FormList"
no edit summary
imported>Chesko |
imported>Dheu |
||
Line 1: | Line 1: | ||
== This method is unreliable == | |||
As of version 1.6, avoid using this method as it appears buggy on some platforms. (See discussion below). AddForm() and Revert() however both work fine, so you can simulate a working method as follows: | |||
<source lang="papyrus"> | |||
; ** Local FormList wont work. Must be created in CK and injected. | |||
; ** CEIF = Custom Empty Injected FormList | |||
Formlist property CEIF auto | |||
Function RemoveForm(FormList source, Form f) | |||
int size = source.GetSize() | |||
if (size > 0) | |||
CEIF.Revert() | |||
int i = 0 | |||
bool notFound = true | |||
Form item | |||
while (i < size && notFound) | |||
item = source.GetAt(i) | |||
if (item != f) | |||
CEIF.AddForm(item) | |||
else | |||
notFound = false | |||
endif | |||
i += 1 | |||
endWhile | |||
if (!notFound) | |||
while (i < size) | |||
CEIF.AddForm(source.GetAt(i)) | |||
i += 1 | |||
endWhile | |||
source.Revert() | |||
size = CEIF.GetSize() | |||
if (size > 0) | |||
i = 0 | |||
while (i < size) | |||
source.AddForm(CEIF.GetAt(i)) | |||
i += 1 | |||
endWhile | |||
endif | |||
endIf | |||
endIf | |||
endFunction | |||
</source> | |||
== RemoveAddedForm bugged? == | == RemoveAddedForm bugged? == | ||
I'm currently trying to manipulate a FormList filled with items using a container. The script is very basic but already gets screwed: | I'm currently trying to manipulate a FormList filled with items using a container. The script is very basic but already gets screwed: |