Jump to content
dot_b0T

Looting items from large item piles issue, need suggestions!

Recommended Posts

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? :)

Link to comment
Share on other sites

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing   0 members

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