Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Question Color of inventory items

Joined
Feb 8, 2019
Messages
2
Currently, I'm trying to learn how to program in java and creating a bot at the same time. I want to create a runecrafting bot and I want it to use essence pouches. When the pouch degrades it turns black. I want to use this colour change to identify when to use NPC contact.

How do I find the colour of an item? I have searched this forum and everyone sais you can find the colour of an entity by GameObjects, however, when I use the developer toolkit there's no information visible about the colour of the entities and/or inventory items.

How do i find the color using the developer toolkit?
 
Joined
Jun 9, 2015
Messages
3,717
@machkNL You'll need to use `getColorSubstitutions()`. If it returns not empty, it means a pouch is degraded. If you query for your pouches in the inventory, you can use filters to figure out if they're broken or not.

This is old code, but it should still work:

Code:
    public SpriteItemQueryResults getPouches() {
        return Inventory.newQuery().names("Small pouch", "Medium pouch", "Large pouch", "Giant pouch").results();
    }

    public boolean isPouchBroken() {
        return getAvailablePouches().stream().anyMatch(p -> p.getDefinition() != null && !p.getDefinition().getColorSubstitutions().isEmpty());
    }
 
Joined
Feb 8, 2019
Messages
2
Thanks for your reply. With your help, I managed to find where in the developer tool I need to look to identify colour changes. Thanks for the code as well, however, I won't be using that any time soon since I'm still in the process of listing all GameObjects I need to make my bot work!
 
Top