Jump to content

Give inventory, then delete inventory?


Jenni Darkwatch
 Share

You are about to reply to a thread that has been inactive for 1566 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Simple question and I am sure it's been asked before but I can't seem to find anything about it when searching:

I have a prim with a list of inventory items, some transfer, some copy. Basically, I'll need to give the items to someone (no problem) and then delete the inventory. It occurred to me that I really don't know what the proper approach there is. Right now, in pseudocode I have:

* Fetch list of inventory items
* Give no-copy/transfer items individually
* Give copy/no-transfer items in a folder
* Delete inventory

I've had reports of items not being delivered, which I attributed to the inventory delete happening too soon. I added a 5s sleep, that seems to have fixed the delivery issue. However... is there a way to know whether the inventory has been delivered? I don't even care if the person has accepted the inventory, all I want to know is if the prim has sent the items so I can delete the inventory.

Thanks folks
-Jenni

Link to comment
Share on other sites

The usual problem that you run into when you want to delete list items and then keep on doing other things with the list is that your indices can get messed up.  If you delete the first list item, then item #2 on the list is suddenly item 1.  If you then address list item #2, you'll get the old item #3 instead of the one you expected..  That's why it's smart to count down from the end of a list toward zero, rather than counting up.  Other than that, your schematic approach seems logical.

Link to comment
Share on other sites

Are you rebuilding the inventory list before you delete the items?  If not, then that could cause problems because, by the time you come to delete stuff, the transfer/no copy items are no longer there to be deleted.

The only way to know that the inventory has been offered (though not, of course, if it's been accepted) is to have the script email you with a report as it calls llGiveInventory or llGiveInventoryList each time.   Probably best to do that with another script and a link message, since llEmail has a 20 second delay.

Link to comment
Share on other sites

Practically speaking I use two loops.

One that loops through the inventory and either appends to a list for llGiveInventoryList() or sends the item directly with llGiveInventory(), depending on permissions.

Then I sleep 5s. That might actually be a bit excessive... still not entirely sure why I even need to sleep, but it seems to solve the issue of missing items on delivery. It's one of those problems I can't reproduce and have to trust users' reports that some deliveries are incomplete.

And then I loop through the list created for llGiveInventoryList (since that's the copy items, i.e. the ones remaining in inventory, the others are already gone) and delete them by name, with llRemoveInventory(). The actual list doesn't get modified during that process.

Oh and Rolig, yes I've done that mistake before ~grins~. Specifically not realizing that looping through llGetInventoryName() and then running a llRemoveInventory() against it... doesn't delete all items. LOL. That was a "duh" moment for sure.

Thanks for the answers. I'm glad I didn't miss anything obvious. Goddess knows that's happened often enough before.

-Jenni

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1566 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...