Jump to content

Giving script where only want to give one of many similarly named items.


Thoth Mason
 Share

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

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

Recommended Posts

I have a prim that contains a script and a bunch of items, all identically named.  They are transfer but no copy.

 

When the prim is touched, I want to give ONE of the items to the toucher.

 

If I understand right, llGiveIventory() will give the entire bunch of items with that name, right?

 

Other than renaming the items to be unique -- really, not what I'd hoped to do -- how can I give one of those items away?

Link to comment
Share on other sites

Was sitting here looking into your question - but during my testing, I realized that SL automatically renames items so you can't have multiples of the same.

 

Example... I tossed 3 items into an object - all named "Object". SL renamed them to Object, Object 1, Object 2... Can't rename them back to Object either.

Link to comment
Share on other sites

Okay, that may be the stupidest post I've made yet.  Sorry about that, I had a window open (script) in front of the contents tab and didn't notice they were all renamed after I dropped the folder in there.  Then went off to read the function description and... 

 

D'oh.

 

Thank you.

 

Link to comment
Share on other sites

Yeah, can't have multiple objects with the same name in a prims inventory. However, llGiveInventory is still the right function.

If you have no copy perms on the items, you could just do 

llGiveInventory(llDetectedKey(0), llGetInventoryName(INVENTORY_OBJECT, 0));

 which would give always the first object in the prims contents.

You may want to check if the prim is not empty already. You may also want to limit how many objects a single avatar can take, by storing the avatars UUID in a list.

  • Like 2
Link to comment
Share on other sites

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

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...