Load and use a complete appearance from inventory

From libopenmetaverse - libomv - Developer Wiki

Jump to: navigation, search


The following prerequisites are required in order for you to be able to change your bots entire appearance :)

Real World

  • This tutorial assumes that you were able to successfully build libsecondlife! If you have not compiled libsl, please follow the instructions on the Getting Started wikipage.
  • Also, if you have no experience with the C# (c-sharp) programming language, I highly recommend that you stop now and please follow the list of links to csharp tutorials located here.
  • Placing the whole appearence folder in the "My Inventory > Objects"

The Code

Note: We are assuming that our main "SecondLife" variable is named "client." If you have a different name for this variable, please substitute the name accordingly

Note #2: This was taken from one of my bots which has the working code if you have issues using this code or find any mistakes feel free to make any amendments :)

Note #3: I took most of the wiki formatting from another wiki article because I am not that good at wikicode :)

Note #4: THIS CODE NO LONGER COMPILES - PLEASE UPDATE --ɹɐbns 03:44, 21 March 2011 (UTC)

static void WearOutFit(string Item)
            //initialize our list to store the folder contents
            LLUUID inventoryItems;
            //make a string array to put our folder names in.
            String[] SearchFolders = { "" };
            //Next we grab a full copy of the entire inventory and get it stored into the Inventory Manager
            client.Inventory.RequestFolderContents(client.Inventory.Store.RootFolder.UUID, client.Self.AgentID, true, true, InventorySortOrder.ByDate);
            //Next we want to step through the directory structure until we get to the item.
            SearchFolders[0] = "Objects";
            //Now we can grab the details of that folder and store it to our list.
            inventoryItems = client.Inventory.FindObjectByPath(client.Inventory.Store.RootFolder.UUID, client.Self.AgentID, SearchFolders[0], 1000);
            //now that we have the details of the objects folder, we need to grab the details of our torch.
            SearchFolders[0] = Item;
            inventoryItems = client.Inventory.FindObjectByPath(inventoryItems, client.Self.AgentID, SearchFolders[0], 1000);