Jump to content
pixstudio

issue with llgiveinventory

Recommended Posts

good day

someone can give me a hint for solving my  problem

i have a box with allowdrop active

trought function i want to move item dropped inside the box to other item rezzed on floor,now the problem if i have only one item rezzed the script work without problem, when i use the function for having a spare copy of the item , the script give to me the error unable to find destination

1° object uuid is obtained trought llisten string a

2° object uuid using  sensor  ( i used llsay for check if the script work,and llsay give to me the correct uuid of the item)

Share this post


Link to post
Share on other sites

I hope I understand correctly.  You have two copies of the same item rezzed on the floor, and you want to use a script to send an item to only one of the two objects.  Is that right?

You should be able to do that, as long as you know the UUID of the object that you are sending to.  Remember that each instance is unique, so will have its own UUID. So, you should be able to write a script that looks basically like this:

integer iLsn;
list lTargets;

default
{
    touch_start(integer num)
    {
        llSensor( "My_target_object","",ACTIVE|PASSIVE,25.0,PI);    // Click to look for all nearby instances of "My_target_object"
    }

    sensor (integer num)
    {
        integer i;
        lTargets = [];    //Start with an empty list of discovered instances
        list lButtonLabels;
        while (i < num)    // Fill the list
        {
            lTargets += [llDetectedKey(i)];
            lButtonLabels += [(string)(i + 1)];
            ++i;
        }
        integer Chan = -1 * (integer)llFrand(1000000.0);
        iLsn = llListen(Chan,"","","");
        llDialog(llGetOwner()," \nThere are " + (string)num + " possible target objects. Which one do you want to send to?" , lButtonLabels, Chan);   // Pick one of the instances
    }

    listen (integer channel, string name, key id, string message)
    {
        llListenRemove(iLsn);
        integer index = (integer)message - 1;    // Convert button label back to a list index
        key kChosen_target = llList2Key(lTargets,index);    // Here's the UUID of the instance you chose
        llGiveInventory(kChosen_target,llGetInventoryName(INVENTORY_OBJECT,0) );    // Send whatever you want to send
    }
}

I make no guarantees that this example is free from typos or silly syntax errors.  It's off the top of my head, untested in world, and purely for illustration.  Still, it should give you an idea of how to distinguish between the target instances.  In practice, you will want to do something better than dumping the full UUID of each target to a dialog button label, as I have.  You may want to have some way to identify the targets visually or by position, too.  Still, this basic approach should work.

EDIT:  Now that I have had a chance to try this script in world, I find that it needed a little tweaking to allow the detected keys (or a proxy) to fit on dialog keys.  I modified it above....

Edited by Rolig Loon

Share this post


Link to post
Share on other sites

tnx Rolig ,but i need to send to every 2 item rezzed ( a, copy_a )

in all the way i used , LListent , of llsensor ,the final result is still the same "Unable to give inventory list: Cannot find destination"

 

Share this post


Link to post
Share on other sites
24 minutes ago, pixstudio said:

tnx Rolig ,but i need to send to every 2 item rezzed ( a, copy_a )

Oh!  Well, that's signficantly easier.  I thought that you wanted to send contents to only one of the objects.  If you want all instances of the receiving object to get whatever you are sending, just write ....

default
{
    touch_start(integer num)
    {
        llSensor( "My_target_object","",ACTIVE|PASSIVE,25.0,PI);    // Click to look for all nearby instances of "My_target_object"
    }

    sensor (integer num)
    {
        integer i;
        while (i < num)    // Identify every single copy of "My_target_object"
        {
            key kChosen_target = llDetectedKey(i);    // And send each one the same thing .....
            llGiveInventory(kChosen_target,llGetInventoryName(INVENTORY_OBJECT,0) );    // Send whatever you want to send
            ++i;
        }
    }
}

BTW, in case you decide that you really do want to send objects to only one of the instances of your targeted object, I made a couple of small adjustments to the script I posted earlier.  I just tested in world and it works as expected.

Edited by Rolig Loon

Share this post


Link to post
Share on other sites

this is my original script that work for one item, (i'm not a good scripter ) ,but if i have 2 rezzed item ,the script still give me error

 

 

integer channel=-00001;
string Pass_Message = "533af431-4bac-803f-e9b2-95b0b3381da7";

delete_all_other_contents()
{
    string thisScript = llGetScriptName();
    string inventoryItemName;
 
    integer index = llGetInventoryNumber(INVENTORY_ALL);
    while (index)
    {
        --index;        // (faster than index--;)
 
        inventoryItemName = llGetInventoryName(INVENTORY_ALL, index);
 
        if (inventoryItemName != thisScript)   
            llRemoveInventory(inventoryItemName);     
    }
}
 
default
{
    on_rez(integer num){
        llListen(channel,"",NULL_KEY,"");
    }

    listen(integer channel, string name, key id, string message)
    {   llSetTimerEvent(0.0);
        Pass_Message = message;
        llSetTimerEvent(0.1);
    }

   state_entry()
{
llListen(channel,"",NULL_KEY,"");
llAllowInventoryDrop(TRUE);
}
    touch_start(integer num_detected)
    {
        float j = (float)Pass_Message;
        
        string thisScript = llGetScriptName();
        list inventoryItems;
        integer inventoryNumber = llGetInventoryNumber(INVENTORY_ALL);
 
        integer index;
        for ( ; index < inventoryNumber; ++index )
        {
            string itemName = llGetInventoryName(INVENTORY_ALL, index);
 
            if (itemName != thisScript)
            {
                if (llGetInventoryPermMask(itemName, MASK_OWNER) & PERM_COPY)
                {
                    inventoryItems += itemName;
                }
                else
                {
                    llSay(0, "Unable to copy the item named '" + itemName + "'.");
                }
            }
        }
 
        if (inventoryItems == [] )
        {
            llSay(0, "No copiable items found, sorry.");
        }
        else
        {
            llGiveInventoryList(Pass_Message, llGetObjectName(), inventoryItems);    // 3.0 seconds delay
       
       delete_all_other_contents();
        }
    }
}

Edited by pixstudio

Share this post


Link to post
Share on other sites

Yes, I see why.  It has several problems, but the important one is that you are trying to use one UUID (the one you call Pass_Message ) to address all instances.  You can't do that.  Every instance has a unique UUID.

Share this post


Link to post
Share on other sites

i retrive the 2 uuid of obj a and obj b , but when i try to send the item x the second item doenst recive item

 

Share this post


Link to post
Share on other sites
7 minutes ago, pixstudio said:

i retrive the 2 uuid of obj a and obj b , but when i try to send the item x the second item doenst recive item

Use either one of the two scripts that I posted.  Either one will work.

Share this post


Link to post
Share on other sites

another question

i can do a  llGiveInventoryList , or llGiveInventory in function  of the name found?

example
if name = object_A

llGiveInventory (target,llGetInventoryName(INVENTORY_OBJECT,0):

else

 llGiveInventoryList(target, llGetObjectName(), inventoryItems);

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...