Jump to content

Crawling the inventory folders


Dirk McKeenan
 Share

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

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

Recommended Posts

I have a background in programming, but not in LSL so much.  I've been looking around and trying to find example LSL scripts for this, but not having much luck.  In fact, so far, I'm getting the impressions it can't be done.

What I would like to do (and I have several different goals in mind) is having a way to start from a given folder and do a tree search.  Maybe just traverse the tree and return a list of objects in the tree.

One project is to have a script that traverses a tree, making note of the folders, then be able to create the same tree (even if for another avatar) in another target folder.

Another project is to search for some condition through a tree of folders, for instance, return a list of empty folders.

I'm not asking for somebody to write these for me, that is most of the fun.  What I'd like is suggestions on the functions I should be looking at and, just maybe, some sample scripts that do something similar.

I appreciate any help / guidance!  Thanks in advance.

  • Like 2
Link to comment
Share on other sites

And if you were to go the viewer-code route, you could either make an extension to RLV (since that's a system that bridges the gap between LSL and viewer functionality via llOwnerSay commands), or look into the Lua scripting system used by Cool VL Viewer.

I don't think there's a way to get data back into the LSL script though, since scripts run exclusively server-side.

Edited by Wulfie Reanimator
Link to comment
Share on other sites

11 hours ago, Gabriele Graves said:

You cannot do this from LSL.  There are no inventory management functions.  You would have to write a bot to do it.

Thanks, Gabriele.  I've not written a bot before, but I can see where that might be interesting.  Are there any links you know of that would give a simple starter example, possibly a little less simple than a "Hello, world" version?

Link to comment
Share on other sites

10 hours ago, Coffee Pancake said:

I think you're heading into the realm of viewer code at this point.

The viewer is open source so are all of the third party projects. How's your C++ ?

My strength is in C, but I suppose I have never had a real need for C++ for a project.  Probably worth looking in that direction.

Link to comment
Share on other sites

1 hour ago, Wulfie Reanimator said:

And if you were to go the viewer-code route, you could either make an extension to RLV (since that's a system that bridges the gap between LSL and viewer functionality via llOwnerSay commands), or look into the Lua scripting system used by Cool VL Viewer.

I don't think there's a way to get data back into the LSL script though, since scripts run exclusively server-side.

This sounds an appealing path.  I'll pose the same question as above to see if there is a not-as-simple-as-hello-world example that I can play with?  I find the idea of extensions to be less daunting than the thought of trying to create a full viewer code fork.  Would this be a situation of needing to work with, for example, the RLVa folks, with a specific viewer group, or all alone out in the cold with a full fork?

Link to comment
Share on other sites

On the RLV(a) path, there's already an interface for looking at folders under the folder "#RLV" (and subfolders but not object contents) and an interface for sending a folder directly into that hierarchy (llGiveInventory("#RLV/~mySpecialFolder"...); IIRC), but there is no way to ask the avatar to give the object something, or to 'rearrange' folders. I doubt a feature request for those would be accepted either. (although you can always ask)

Link to comment
Share on other sites

With RLV, the most you can get about folder/sub-folder contents is none/some/all items worn. Which, depending on what you're trying to do, and how (assuming you're only looking at messing with yourself) you've arranged your #RLV folders and sub-folders does actually give for a multitude of absolutely non-creepy uses

Link to comment
Share on other sites

9 hours ago, Dirk McKeenan said:

Thanks, Gabriele.  I've not written a bot before, but I can see where that might be interesting.  Are there any links you know of that would give a simple starter example, possibly a little less simple than a "Hello, world" version?

I'm sorry I'd love to help but writing a bot is outside of my area of expertise.

Link to comment
Share on other sites

18 hours ago, KT Kingsley said:

With RLV, the most you can get about folder/sub-folder contents is none/some/all items worn. Which, depending on what you're trying to do, and how (assuming you're only looking at messing with yourself) you've arranged your #RLV folders and sub-folders does actually give for a multitude of absolutely non-creepy uses

Thank you, KT.  Yes, this is intended to be run by the owner (me, my partner, and an alt or two).  Two things I have wanted specifically to try to do are:

  • Return a list of empty folders (I expect I'd want to delete manually since the next item is to create a tree template of empty folders)
  • Start with an existing tree of folders (or some meta-description of such a tree) and create a new tree mirroring that structure

This has primarily been for managing folders in RLV for the CTS Wardrobe, but I'd expect that I might want to act on folders not under RLV which would probably put me into the LSL realm of "sorry, can't do that".

I had thought it would be great to be able to create a traversal routine and pass it a function to perform on each node discovered, but I can see how that would quickly get into a creepy world.

KT, are you aware of any options for either of the above bullet point ideas?

Link to comment
Share on other sites

The RLV command @getinvworn (which is what I was thinking of in my earlier post) will, in fact, also indicate empty folders and sub-folders, so you could try using this to build your list.

Using llGiveInventoryList as specified in the RLV wiki page might be useful for building a new inventory tree (you can specify sub and sub-sub-etc-folders in the folder name parameter), but there are problems: the root folder of the tree in the #RLV folder must have a name starting with a tilde (which you could rename manually), the item list can't be empty (so your new tree will contain items, at least in its terminal folders – but maybe giving the items a common, easily searched name will make manual deletion easier – or just use a non-wearable asset), you'll have to get your head around the order in which you call the function for the various branches so as not to create duplicate folders in your tree, and you'll have to respond to an Accept/Decline dialog with every call.

 

Link to comment
Share on other sites

On 12/4/2022 at 7:30 PM, Wulfie Reanimator said:

I don't think there's a way to get data back into the LSL script though, since scripts run exclusively server-side.

Well, in theory, you can inject data into the script using llRequestURL() and http_request() event...

Never tried such monstrosity tho :D

 

  • Like 1
Link to comment
Share on other sites

On 12/4/2022 at 7:30 AM, Wulfie Reanimator said:

And if you were to go the viewer-code route, you could either make an extension to RLV (since that's a system that bridges the gap between LSL and viewer functionality via llOwnerSay commands), or look into the Lua scripting system used by Cool VL Viewer.

I don't think there's a way to get data back into the LSL script though, since scripts run exclusively server-side.

Wait what?? Lua scripting in CVLV?? Like viewer plugins in radegast? Link to info?

Edited by ST33LDI9ITAL
Link to comment
Share on other sites

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