shaba123 Posted June 2, 2023 Share Posted June 2, 2023 (edited) if (itemToPickUp.interact("Take")) { lootValue = lootValue + itemValues.get(itemToPickUp.getName()); Sleep.sleepUntil(() -> !itemToPickUp.exists() , 5000); log(lootValue); As you can see after i click take on the grounditem i add the value of the item to my lootvalue integer. The problem is if it clicks the item more than once it will add the value of the item twice. I cant check if the item is in my inventory to add the value because i am using a looting bag. I could add a longer sleep timer to make sure my player reaches the loot before clicking it again but someitmes my player is frozen. Any ideas guys? thanks edit: also another question while iv got you guys, i sleep until !item.exists but that doesnt correctly if there is multiple of the same item on the ground. Edited June 2, 2023 by shaba123 Quote Link to comment Share on other sites More sharing options...
07ETHFarmer Posted June 2, 2023 Share Posted June 2, 2023 Sleep if moving 1 Quote Link to comment Share on other sites More sharing options...
Czar Posted June 3, 2023 Share Posted June 3, 2023 I personally make a hash of inventory before looting and after looting, and if the two values are different then it means you picked up an item, ofc this doesn't apply to looting bag so you may want to check if grounditem disappeared (still can be looted by someone else tho) so it's never 100% accurate I would definitely give this one a read though, it's an inventory listener that keeps track of items gained: 1 Quote Link to comment Share on other sites More sharing options...
Gunman Posted June 3, 2023 Share Posted June 3, 2023 On 6/2/2023 at 7:14 AM, shaba123 said: edit: also another question while iv got you guys, i sleep until !item.exists but that doesnt correctly if there is multiple of the same item on the ground. You will probably have to make your own exist method. And best way to track loot for looting bag would be when you bank update it, otherwise check for inventory changes then update etc 1 Quote Link to comment Share on other sites More sharing options...
shaba123 Posted June 4, 2023 Author Share Posted June 4, 2023 19 hours ago, Czar said: I personally make a hash of inventory before looting and after looting, and if the two values are different then it means you picked up an item, ofc this doesn't apply to looting bag so you may want to check if grounditem disappeared (still can be looted by someone else tho) so it's never 100% accurate I would definitely give this one a read though, it's an inventory listener that keeps track of items gained: 12 hours ago, Gunman said: You will probably have to make your own exist method. And best way to track loot for looting bag would be when you bank update it, otherwise check for inventory changes then update etc Thank you ! Quote Link to comment Share on other sites More sharing options...