MantisBT - opensim
View Issue Details
0005927opensim[REGION] Script Functionspublic2012-03-11 10:222014-07-29 13:40
master (dev code) 
Grid (Multiple Regions per Sim)
Mono / Linux64
0005927: [PATCH] osGetInventoryDesc
There does not seem to be a function in lsl to get the description from an object in the inventory of a prim.

This could be userfull to get the hypergrid description from landmarks stored in the inventory of a prim.

I hope the patch is correct, I could not find the wiki doc on how to create a patch.
No tags attached.
patch osGetInventoryDesc.patch (3,321) 2012-03-11 10:22
patch osGetInventoryDesc_item.patch (2,967) 2012-03-12 18:33
Issue History
2012-03-11 10:22MarcelEdwardNew Issue
2012-03-11 10:22MarcelEdwardFile Added: osGetInventoryDesc.patch
2012-03-12 10:47justinccStatusnew => patch included
2012-03-12 17:44GuduleLapointeNote Added: 0021084
2012-03-12 17:45GuduleLapointeNote Edited: 0021084bug_revision_view_page.php?bugnote_id=21084#r232
2012-03-12 18:33GuduleLapointeFile Added: osGetInventoryDesc_item.patch
2012-03-12 18:36GuduleLapointeNote Added: 0021085
2012-03-13 01:07MarcelEdwardNote Added: 0021086
2012-03-16 21:06justinccNote Added: 0021124
2012-03-16 21:06justinccStatuspatch included => resolved
2012-03-16 21:06justinccResolutionopen => fixed
2012-03-16 21:06justinccAssigned To => justincc
2014-07-29 13:40chi11kenStatusresolved => closed

2012-03-12 17:44   
(edited on: 2012-03-12 17:45)
Using (int type, int number) like in llGetInventoryName() forces an duplicate search.

It means that the script will make twice the same research if you need to get other information (the name, for instance). And they are chance most will need more than the desc alone.

This lookup should be made only once (with llGetInventoryName) to get the object(s) of a certain type, and even in some case, doesn't need to be done at all (when you know the name of the object).

After that, you should use the name or the key you get from name for other queries, like in
    llGetInventoryKey(string name)
    llGetInventoryPermMask(string item, int mask)
    llGetInventoryCreator(string item)
    llGetInventoryType(string name)

I am testing now another patch following this model. I will update here.

2012-03-12 18:36   
I uploaded an alternative patch, using string item as argument.


Code is smaller, it avoids a second similar search inside the function, and simplifies the code in the script. I think this is the way the function should be implemented, following equivalent llGetInventory* functions design.
2012-03-13 01:07   
Thanks for the refactoring.
2012-03-16 21:06   
Applied as git master 4a57112. Thanks guys!

On a side note, would it make sense to have something like osGetInventoryItemDetails() analagous to llGetObjectDetails()? Not that I object to individual functions since pulling apart return values from a list is messy, but it might make for a more extensible function. I don't know for sure - I haven't done a lot of LSL scripting.