Jump to content

Looting items from large item piles issue, need suggestions!


Recommended Posts

Posted

Hello! I have a script that relies on some looting. Got a problem though when it encounters large item piles resulting in items in the right-click list not showing up on the screen cause there are too many items in the pile. I was thinking I would solve this by making the script ignore the specific item if its not showing in the list instead of repeatedly trying to pick it up.  Lets say its a Salmon in the bottom of the pile and the script is set to loot salmons, is it possible to ignore a specific salmon that is in the bottom and isnt showing within the screen region or will it result in ignoring all salmons? not quite sure how to solve this.

here is an example pic of a big loot pile that dont display all items if you wonder what i meant. 5244c8a6ab3423ae4d3b4994eee48167.png

any suggestions how to solve it? :)

Posted

Hmm, this is quite an usual problem. You could try the following:


Sort items by index

The GroundItem API has a GroundItem#getIndex method which vaguely states "getIndex in interface Entity" which could refer to the right-click menu and the index option in that:

groundItems.getAll().stream()
			.filter((item) -> item.getName().equals("Leaping sturgeon"))
			.sorted((item1, item2) -> Integer.compare(item1.getIndex(), item2.getIndex()))
			.forEach((item) -> item.interact("Take"));

 

If that doesn't work, you could try sorting using Menu#getMenuIndex like so:

menu.getMenuIndex(item, new String[] { "Leaping sturgeon" }, new String[] { "Take" });

 

Or...

Use the interact method without a parameter

However, you run the risk of picking up items you don't want because when you don't enter anything in, the bot left clicks.

 

Or...

Manually select menu options by strictly using the Menu API

That would be more work than it's worth, but if nothing else works then you can do this.

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...