Jump to content

Transfer no-copy items from Contents?


Cancer Triellis
 Share

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

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

Recommended Posts

Hello everyone. I have a script set to give the content of an object to the owner's inventory on-click. Thing is, it only copies the items, so if the perms of an item are no copy/trans, it won't work. 

I picked this script up from the LSL Library I believe, could anyone lend a hand with any quick-tweaks (I imagine there's only a line or two that needs to be adjusted) to fix this?

 string gAnimName = "HoldBox"; // what animation to play?

default
{
    state_entry()
    {
        llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); // ask the owner for permission to trigger animations
        llStartAnimation(gAnimName); // automatically trigger animation.
    }
    on_rez(integer param)
    {
        llResetScript(); // reset the script as soon as it starts.
    }
    
    attach(key id)
    {
        integer perm = llGetPermissions();
        
        if (id != NULL_KEY) // make sure we're actually attached.
        {        
            if (! (perm & PERMISSION_TRIGGER_ANIMATION)); 
        }
    }
    touch_start(integer num_detected)
    {
        string thisScript = llGetScriptName();
 
        list inventoryItems;
        integer inventoryNumber = llGetInventoryNumber(INVENTORY_ALL);
 
 
        integer index;
        do
        {
            string itemName = llGetInventoryName(INVENTORY_ALL, index);
 
            if (itemName != thisScript)
            {
                if (llGetInventoryPermMask(itemName, MASK_OWNER) & PERM_COPY)
                {
                    inventoryItems += itemName;
                }
                else
                {
                    llSay(PUBLIC_CHANNEL, "Unable to copy the item named '" + itemName + "'.");
                }
            }
        }
        while(++index < inventoryNumber);
 
        //  if the list is empty, the length of the list is 0 (FALSE)
        if (!llGetListLength(inventoryItems))
        {
            llSay(PUBLIC_CHANNEL, "No copiable items found, sorry.");
        }
        else
        {
            llGiveInventoryList(llDetectedKey(0), llGetObjectName(), inventoryItems);//  3.0 seconds delay
        }
    }
}

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3792 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...