harrypotter Posted April 6, 2017 Posted April 6, 2017 (edited) This seems to fail on Low CPU mode. It will continue to pick the bush even when the inventory contains Cadava berries. if (!script.inventory.contains("Cadava berries")) { if (!bushArea.contains(script.myPosition())) { script.getWalking().webWalk(bushArea); } else { Entity bush = script.getObjects().closest("Cadava bush"); if (bush != null) { if (bush.interact("Pick-from")) { Sleep.sleepUntil(() -> script.inventory.contains("Cadava berries"), 5000); } } } } If I pause the script and resume again it works as expected? Edited April 6, 2017 by harrypotter
Mr Asshole Posted April 6, 2017 Posted April 6, 2017 You don't need the extra if statement at the end. The more conditionals, the more memory used by the script.
IDontEB Posted April 6, 2017 Posted April 6, 2017 (edited) nvm i dont read enough Edited April 6, 2017 by IDontEvenBot
harrypotter Posted April 6, 2017 Author Posted April 6, 2017 2 minutes ago, IDontEvenBot said: your bush.interact("Pick-from") is inside the Boolean of the if statement?? I dont know if that could cause it but that might be an issue. No because it shouldn't be passing the very first if statement after the first loop. The bot will pick the berries, however on the next loop the first if statement continues to return false
IDontEB Posted April 6, 2017 Posted April 6, 2017 (edited) 27 minutes ago, harrypotter said: No because it shouldn't be passing the very first if statement after the first loop. The bot will pick the berries, however on the next loop the first if statement continues to return false Might be possible if Inventory is not the currently open tab, then you wont register as having the berries in inv when you check inventory??? Or the game doesn't update quick enough on low CPU mode and your code checks before the inv has updated? Edited April 7, 2017 by IDontEvenBot
harrypotter Posted April 7, 2017 Author Posted April 7, 2017 7 hours ago, IHB said: add a check for ur inv being full My inv isn't full though, the steps before this point ensures that. Regardless this wouldn't fix the issue.
IHB Posted April 7, 2017 Posted April 7, 2017 2 hours ago, harrypotter said: My inv isn't full though, the steps before this point ensures that. Regardless this wouldn't fix the issue. We need more code than what youve given to know what you're doing
harrypotter Posted April 7, 2017 Author Posted April 7, 2017 5 minutes ago, IHB said: We need more code than what youve given to know what you're doing Not really, the most important thing here is that my inventory does contain the berries, yet this snippet executes. Surrounding code is irrelevant.
Stimpack Posted April 7, 2017 Posted April 7, 2017 how many times does it repeat after inventory already contains berries?
dmmslaver Posted April 7, 2017 Posted April 7, 2017 I submitted a bug report about inventory needing to be open in order to view items. If they don't fix it that breaks all scripts that use tabs other than inventory and use any item checking for script logic. So all of them 6 hours ago, Stimpack said: how many times does it repeat after inventory already contains berries? Idk but on my tut island script it will mine entire inventory of ore and won't register as having one until the tab is opened.
harrypotter Posted April 7, 2017 Author Posted April 7, 2017 7 hours ago, Stimpack said: how many times does it repeat after inventory already contains berries? Indefinitely until I pause then resume
Juggles Posted April 7, 2017 Posted April 7, 2017 Inventory is already checked when it's not open. Something is wrong in your script
Stimpack Posted April 7, 2017 Posted April 7, 2017 23 minutes ago, harrypotter said: Indefinitely until I pause then resume try getInventory().getItemInSlot of cadava berries then check the name of it, maybe there's weird formatting? idk. could also open your inventory then picking from bush, as suggested above. really strange based on code, it shouldn't be doing that..
dmmslaver Posted April 8, 2017 Posted April 8, 2017 7 hours ago, Juggles said: Inventory is already checked when it's not open. Something is wrong in your script Really because I'm sitting here watching a blank script with inventory.getAmount returning zero with the item in inventory..