Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Finding Duplicate Creators in Dropped Inventory

Bloodsong Termagant
Manic Artist
Join date: 22 Jan 2007
Posts: 615
07-19-2007 08:52
heyas;

i wanted to put together a weekly riddle contest, and for people to submit answers, i wanted them to be able to drop notecards into the contest object.

now, apparently, i can get "change & CHANGE_INVENTORY_DROPPED" (or whatever it is, dont have the wiki open at the moment), but there's no way to find out what the heck the last object dropped in there IS. is that right? gah.

so now to make sure only notecards are dropped, i have to comb through the inventory and throw out any non-notecards? (and my script, of course!) that's not too hard.

but i wanted people to only be able to drop in one card, and any subsequent cards they dropped would be discarded. well.... since i can't get the latest object and i cant (that i know of?) get creation dates of objects, i suppose the best i can do is just go through the notecards and make sure there's only one from each creator.
this sounds like a big, messy, headachy sort. i've never really done sorts... or sort 'n' compares.... is there an easy/elegant way to go about this? :/
_____________________
Why Johnny Can't Rotate:
http://forums.secondlife.com/showthread.php?t=94705
Rabbitsfoot Soothsayer
Registered User
Join date: 7 Feb 2006
Posts: 25
07-19-2007 08:56
Would this help ?
http://www.slexchange.com/modules.php?name=Marketplace&file=item&ItemID=31967

Alternatively search slexch for "DUPLICATE"
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
07-19-2007 11:37
Let's see...

You can just ignore scripts, they don't qualify for llAllowInventoryDrop(). Other inventory types besides the desired notecards could either be removed or just ignored, I suppose.

You could maintain a strided list of the keys of the notecards and their creators (from llGetInventoryCreator), and llListSort by creator, then scan through for duplicates, although I'm not sure that sort will save much.

Instead... well, it's hardly elegant, but my initial thought would be to keep such a list, unsorted, and with each CHANGED_ALLOWED_DROP event, look through every notecard in inventory to see if it's new (can't be found in the list), and if it is, then see if the creator is new, and if it is, then append it to the list, else (its creator isn't new) remove it.

But that all assumes that the user is dropping notecards that they created from scratch themselves, not somebody else's that they edited.

(Also, as you probably already know, you can't test this yourself, because with modify perms, you'll always get CHANGED_INVENTORY, never CHANGED_ALLOWED_DROP events.)
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
07-19-2007 12:03
Scripts cannot be dropped into an object that has llAllowInventoryDrop(TRUE); set. It gets real cranky and shouts "Not allowed to edit this!!" or somesuch.

My vote would be for a two-prim solution. First prim contains the script and is llAllowInventoryDrop(TRUE);. When the changed() event fires, only look at notecards and use link messages queries to another script in the second prim to check to see if there already is a notecard in its inventory by that creator. Reply back with the result and then, if it is Not Found, then llGiveInventory() the notecard to the second prim, and delete it from the first. If you want, you can also delete all non-notecard crap that is dropped in there as well, but I don't think it is necessary, since the script can easily ignore it anyway.

When it is time to check the entries, just open the second prim and pull out the validated notecards.
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
07-19-2007 12:28
From: Talarus Luan
My vote would be for a two-prim solution.
Yes, if you can afford a prim, this is *way* better. (Doh! And I just did it this way, not a month ago... now I remember why!) :)