dot_b0T Posted November 4, 2018 Share Posted November 4, 2018 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. any suggestions how to solve it? Quote Link to comment Share on other sites More sharing options...
liverare Posted November 4, 2018 Share Posted November 4, 2018 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. 1 Quote Link to comment Share on other sites More sharing options...