OsGetInventoryLastOwner

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m (Change See Also)
 
(6 intermediate revisions by one user not shown)
Line 4: Line 4:
 
|delay=0
 
|delay=0
 
|function_syntax=key osGetInventoryLastOwner(string itemName_or_itemId)
 
|function_syntax=key osGetInventoryLastOwner(string itemName_or_itemId)
|ossl_example=<source lang="lsl">
+
|description=Returns the id(key) of the last owner of inventory item with id "itemName_or_itemId" if that parameter is a valid key or with that name if not.
 +
|ossl_example=
 +
To test this example script, you must set the object and script to "Anyone: Copy".<br>
 +
Another user can then copy the object to their inventory, rezz it and test it.<br>
 +
In this way, this user becomes the new owner of the object without modification rights (no-mod).
 +
<source lang="lsl">
 +
//
 +
// osGetInventoryLastOwner Script Exemple
 +
// Author: Ubit
 +
//
 +
 
 
default
 
default
 
{
 
{
 +
    state_entry()
 +
    {
 +
        llSay(PUBLIC_CHANNEL, "Drop a item to this primitive's inventory to see osGetInventoryLastOwner usage.");
 +
        llAllowInventoryDrop(TRUE);
 +
    }
  
...
+
     changed(integer change)
     changed(integer ch)
+
 
     {
 
     {
         if (ch & CHANGED_ALLOWED_DROP)
+
         if (change & CHANGED_INVENTORY)        
 
         {
 
         {
 +
            llSay(PUBLIC_CHANNEL, "The inventory has changed ...");
 +
        }
 +
 +
        if (change & CHANGED_ALLOWED_DROP)
 +
        {
 +
            llSay(PUBLIC_CHANNEL, "An item has been dropped in this primitive's inventory");
 +
 
             key id = osGetLastChangedEventKey();
 
             key id = osGetLastChangedEventKey();
             if(id != "")
+
 
 +
             if (id != "")
 
             {
 
             {
                llSay(0,"got inventory dropped item "+(string)id);
 
                llSay(0,"name " + osGetInventoryName(id));
 
                llSay(0,"desc " + osGetInventoryDesc(id));
 
 
                 key who = osGetInventoryLastOwner(id);
 
                 key who = osGetInventoryLastOwner(id);
                 llSay(0,"dropped by " + llKey2Name(who) +" ("+(string)who +")");  
+
                 llSay(PUBLIC_CHANNEL, "I got inventory dropped item " + (string)id);
 +
                llSay(PUBLIC_CHANNEL, "Item dropped by "+ (string)who + " (" + llKey2Name(who) + ")");
 +
                llSay(PUBLIC_CHANNEL, "The item name is " + osGetInventoryName(id));
 +
                llSay(PUBLIC_CHANNEL, "The item description is " + osGetInventoryDesc(id));
 +
            }
 +
 
 +
            else
 +
            {
 +
                llSay(PUBLIC_CHANNEL, "This item id is empty ...");
 
             }
 
             }
 
         }
 
         }
...
+
    }
 
}
 
}
 
</source>
 
</source>
|description=Returns the id(key) of the last owner of inventory item with id "itemName_or_itemId" if that parameter is a valid key or with that name if not.
 
 
|additional_info=This function was added in 0.9.0.1 Dev
 
|additional_info=This function was added in 0.9.0.1 Dev
 
Implemented February, 22 2019 in GIT# bd27573130d4a40d678c81c687591708ab4e4f34
 
Implemented February, 22 2019 in GIT# bd27573130d4a40d678c81c687591708ab4e4f34
 
}}
 
}}
 +
== See Also ==
 +
* [[osGetInventoryName]]
 +
* [[osGetInventoryDesc]]
 +
* [[osGetInventoryItemKey]]
 +
* [[osGetInventoryLastOwner]]
 +
* [[osGetLastChangedEventKey]]

Latest revision as of 18:58, 5 December 2020

key osGetInventoryLastOwner(string itemName_or_itemId)
Returns the id(key) of the last owner of inventory item with id "itemName_or_itemId" if that parameter is a valid key or with that name if not.
Threat Level This function does not do a threat level check
Permissions Use of this function is always allowed by default
Extra Delay 0 seconds
Example(s)
To test this example script, you must set the object and script to "Anyone: Copy".

Another user can then copy the object to their inventory, rezz it and test it.
In this way, this user becomes the new owner of the object without modification rights (no-mod).

//
// osGetInventoryLastOwner Script Exemple
// Author: Ubit
//
 
default
{
    state_entry()
    {
        llSay(PUBLIC_CHANNEL, "Drop a item to this primitive's inventory to see osGetInventoryLastOwner usage.");
        llAllowInventoryDrop(TRUE);
    }
 
    changed(integer change)
    {
        if (change & CHANGED_INVENTORY)         
        {
            llSay(PUBLIC_CHANNEL, "The inventory has changed ...");
        }
 
        if (change & CHANGED_ALLOWED_DROP)
        {
            llSay(PUBLIC_CHANNEL, "An item has been dropped in this primitive's inventory");
 
            key id = osGetLastChangedEventKey();
 
            if (id != "")
            {
                key who = osGetInventoryLastOwner(id);
                llSay(PUBLIC_CHANNEL, "I got inventory dropped item " + (string)id);
                llSay(PUBLIC_CHANNEL, "Item dropped by "+ (string)who + " (" + llKey2Name(who) + ")");
                llSay(PUBLIC_CHANNEL, "The item name is " + osGetInventoryName(id));
                llSay(PUBLIC_CHANNEL, "The item description is " + osGetInventoryDesc(id));
            }
 
            else
            {
                llSay(PUBLIC_CHANNEL, "This item id is empty ...");
            }
        }
    }
}
Notes
This function was added in 0.9.0.1 Dev

Implemented February, 22 2019 in GIT# bd27573130d4a40d678c81c687591708ab4e4f34


[edit] See Also

Personal tools
General
About This Wiki