findAllItems

  • the method returns items just fine. but the array is always empty for clothing constructions and objects?


  • Sorry for my late response! But unfortunately I couldn't reproduce this issue on my end :wat: What itemID do you use when looking for a clothing, construction or object item? Working with these types of items is a bit tricky actually, since they're typically represented by a generic item. For instance, most objects (with few exceptions) are represented by the objectkit item (ID 790), while clothes are typically represented by the clothingitem (ID 785) and construction are represented by the constructionitem (ID 780).


    In order to find a particular object item, for example, you can use the relateditem field from an ObjectDefinition. Example:

    Java
    //Example to find all pianos in inventory.
    //First we get the object definition for a piano
    Objects.ObjectDefinition objectDef = Definitions.getObjectDefinition("piano");
    //Then we get the related item def (the item that represents a piano, most likely an "objectkit" item)
    Items.ItemDefinition itemDef = Definitions.getItemDefinition(objectDef.relateditem);
    //Use that item id to find all instances in inventory
    int[] itemSlots = inventory.findAllItems(itemDef.id, 0, Inventory.SlotType.Inventory);
  • Sorry for my late response! But unfortunately I couldn't reproduce this issue on my end :wat: What itemID do you use when looking for a clothing, construction or object item? Working with these types of items is a bit tricky actually, since they're typically represented by a generic item. For instance, most objects (with few exceptions) are represented by the objectkit item (ID 790), while clothes are typically represented by the clothingitem (ID 785) and construction are represented by the constructionitem (ID 780).


    In order to find a particular object item, for example, you can use the relateditem field from an ObjectDefinition.

    i believe i was using the clothingid from the definitions for example. i some how missed the relateditemid in the definitions.

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!