Retrieving inventory items

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Retrieving inventory items

jeff1564
Hello folks,

I am playing with some bots here but when i try retrieve the inventory items from the bot I just get the folders and no items bellow is an example code:


        private Inventory Inventory;
       
        private void button1_Click(object sender, EventArgs e)
        {
            Inventory = Client.Inventory.Store;
            InventoryFolder rootFolder = Inventory.RootFolder;
            List<InventoryBase> contents = Client.Inventory.Store.GetContents(rootFolder);      
           
            foreach (InventoryBase i in contents)
            {
                if (i is InventoryFolder)
                {
                    InventoryFolder folderr = (InventoryFolder)i;
                    List<InventoryBase> contentss = Client.Inventory.Store.GetContents(folderr);
                    if (contentss.Count > 0)
                    {
                        foreach (InventoryBase ii in contentss)
                        {
                            if (ii is InventoryFolder)
                            {
                                MessageBox.Show("This is a folder: " + ii.ToString());

                            }
                            if (ii is InventoryItem)
                            {
                                MessageBox.Show("This is an Item: " + ii.ToString());
                            }

                            //MessageBox.Show("is > 0 " + contentss.ToString());
                        }
                    }
                    //MessageBox.Show(i.ToString());
                   
                }
                if (i is InventoryItem)
                {
                    MessageBox.Show("I am an Item: " + i.ToString());

                }
            }
           

           
        }

what am i doing wrong??? there is a trick to retrieve items??

_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|

Re: Retrieving inventory items

Karen_Palen
Hmmm,

Could this be the same thing that bit me:

"I usually get errors when I set the AllowOSFunctions stuff to false in the
OpenSim.ini file. Other than that everything runs fine with XEngine."

Setting this to true and the next parameter to "severe" (i.e. allowing any OS function) might do the trick.

I do recall that this parameter was put in as a hack for some of the problems with Hypergrid security. You don't want just anyone on your grid able to fool with your inventory or your MySql database directly for example.

In standalone mode there is clearly no problem, if you link to a grid though you need to research that issue in depth.

Karen

Karen

--- On Sat, 9/26/09, Jeff1564 <[hidden email]> wrote:

> From: Jeff1564 <[hidden email]>
> Subject: [Opensim-users] Retrieving inventory items
> To: [hidden email]
> Date: Saturday, September 26, 2009, 9:56 AM
> Hello folks,
>
> I am playing with some bots here but when i try retrieve
> the inventory items from the bot I just get the folders and
> no items bellow is an example code:
>
>
>         private Inventory Inventory;
>
>        
>         private void button1_Click(object sender,
> EventArgs e)
>         {
>             Inventory = Client.Inventory.Store;
>             InventoryFolder rootFolder =
> Inventory.RootFolder;
>             List<InventoryBase> contents =
> Client.Inventory.Store.GetContents(rootFolder);      
>
>
>            
>             foreach (InventoryBase i in
> contents)
>             {
>                 if (i is InventoryFolder)
>                 {
>                     InventoryFolder
> folderr = (InventoryFolder)i;
>
>                    
> List<InventoryBase> contentss =
> Client.Inventory.Store.GetContents(folderr);
>                     if (contentss.Count
> > 0)
>                     {
>                         foreach
> (InventoryBase ii in contentss)
>
>                         {
>                             if
> (ii is InventoryFolder)
>                             {
>                                
> MessageBox.Show("This is a folder: " +
> ii.ToString());
>
>
>                             }
>                             if
> (ii is InventoryItem)
>                             {
>                                
> MessageBox.Show("This is an Item: " +
> ii.ToString());
>
>                             }
>
>                            
> //MessageBox.Show("is > 0 " +
> contentss.ToString());
>                         }
>                     }
>                    
> //MessageBox.Show(i.ToString());
>
>                    
>                 }
>                 if (i is InventoryItem)
>                 {
>                    
> MessageBox.Show("I am an Item: " + i.ToString());
>
>                 }
>             }
>
>            
>
>            
>         }
>
> what am i doing wrong??? there is a trick to retrieve
> items??
>
>
> -----Inline Attachment Follows-----
>
> _______________________________________________
> Opensim-users mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/opensim-users
>


     

_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users
Reply | Threaded
Open this post in threaded view
|

Re: Retrieving inventory items

jeff1564
Hi Karen,

Thank you for the reply, a just "Thread.Sleep(50);" did the trick without change OpenSim.ini. And yes as grid owners we need be aware about any kinds of hack that can be done to be one step forward to avoid it.

Sorry for the really dirty example code :)

On Sat, Sep 26, 2009 at 12:59 PM, Karen Palen <[hidden email]> wrote:
Hmmm,

Could this be the same thing that bit me:

"I usually get errors when I set the AllowOSFunctions stuff to false in the
OpenSim.ini file. Other than that everything runs fine with XEngine."

Setting this to true and the next parameter to "severe" (i.e. allowing any OS function) might do the trick.

I do recall that this parameter was put in as a hack for some of the problems with Hypergrid security. You don't want just anyone on your grid able to fool with your inventory or your MySql database directly for example.

In standalone mode there is clearly no problem, if you link to a grid though you need to research that issue in depth.

Karen

_______________________________________________
Opensim-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/opensim-users