|
hiro Voss
Registered User
Join date: 6 Oct 2006
Posts: 57
|
07-04-2007 02:09
I am removing anywhere from 4 to 20 items from an objects inventory with a for loop and llRemoveInventory. Each time it does exactly half the items and then starts throwing the "Missing inventory item '' error in debug. Doesn't matter how many objects always fails at half the objects.
Anyone got any ideas or seen this before? Strange that a search on llRemoveInventory in this forum gets no items found.
|
|
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
|
07-04-2007 04:52
When removing inventory in a loop I advise you to count backwards as the total number of inventory items decreases as you remove them
If you have 20 items in the inventory and start removing item 11 through 20 everything will work out ok until you get to item 16 by which you already have removed 5 items and thus lowered the item count from 20 to 15. 16 is thus not valid anymore.
Remove items in the order of 20 through 11 and things will work out just fine.
|
|
hiro Voss
Registered User
Join date: 6 Oct 2006
Posts: 57
|
Totally makes sense...
07-06-2007 00:18
It didn't occur to me that i would be updating the number each swing through the loop. If I understand what you are say:
Start Loop with 4 objects to delete
delete object #1 - objects 2, 3, and 4 left objects repolled and numbered by sim - objects in inv. 1, 2, 3 loop again delete object #2 - objects 1,3 left objects renumbered by sim - objects in inv. 1, 2 loop again delete object #3 - "Missing inventory item '' error cause theres only two objects at this point.
This sound like what you're saying? This seems like a bit of a bug, maybe not.
|
|
hiro Voss
Registered User
Join date: 6 Oct 2006
Posts: 57
|
O.K., just occured too me,
07-06-2007 00:22
you all probably got this right off. I just need to not increment the object number in the loop. If I just increment the number of times through the loop and just keep removing item #1 I should be fine.
Thanks Squirrel Wood...good call, I appreciate it.
|