Novak Posted December 4, 2014 Share Posted December 4, 2014 (edited) For some reason it seems really slow to me: depositAll(uncut); for(int i = 0; i < 100 && inventory.contains(uncut); i++) { sleep(50); } is waiting a couple seconds to continue when it should respond within 50ms. Any ideas? Edited December 4, 2014 by Novak Link to comment Share on other sites More sharing options...
Czar Posted December 4, 2014 Share Posted December 4, 2014 (edited) You are calling that method 100 times, so it's 50 * 100 ms, just do getAmount if you want to get the amount of uncuts Edited December 4, 2014 by Czar Link to comment Share on other sites More sharing options...
Novak Posted December 4, 2014 Author Share Posted December 4, 2014 (edited) You are calling that method 100 times, just do getAmount if you want to get the amount of uncuts, or what are you trying to achieve? I will help i want it to continue after the uncuts have left the inventory. So it should sleep for 50ms intervals until the uncuts have left the inventory. Instead, it is taking seconds to update which is causing it to sleep for more 50ms intervals. The 100 is there so that if it exceeds 100 50ms intervals, it will time out and go back into the loop Edited December 4, 2014 by Novak Link to comment Share on other sites More sharing options...
Czar Posted December 4, 2014 Share Posted December 4, 2014 (edited) Ohh I understand, the best way to do this is returning 50 on the onLoop method, because it will re-loop after 50ms until the action is done. Edited December 4, 2014 by Czar Link to comment Share on other sites More sharing options...
Novak Posted December 4, 2014 Author Share Posted December 4, 2014 (edited) if (depositAll(uncut)) { sleep(50); } should be enough thats bad though. Its a static sleep and it doesn't check the the item has actually left the inventory. there is nothing wrong with the logic, it has to do with how .contains is updating, which is my question In response to your edit: that means it will keep trying to deposit it every 50ms, which it takes longer for the item to leave the inventory than that. So in that case it would keep spamming items to deposit until it leaves, which probably takes about a second. 1000/50 is 20, which means that it would spam the deposit 20 or so times until it left, which is very bot like. Edited December 4, 2014 by Novak Link to comment Share on other sites More sharing options...
Czar Posted December 4, 2014 Share Posted December 4, 2014 if (getInventory().contains(uncut)){ for(int i = 0; i < 100; i++) { sleep(50); } } Idk, try that Link to comment Share on other sites More sharing options...
Novak Posted December 4, 2014 Author Share Posted December 4, 2014 if (getInventory().contains(uncut)){ for(int i = 0; i < 100; i++) { sleep(50); } } Idk, try that that is literally the same thing as my OP, just with an unneeded if statement Link to comment Share on other sites More sharing options...
Czar Posted December 4, 2014 Share Posted December 4, 2014 Lol my bad, I read it wrong, well IDK what else to say, just find another way to sleep after depositing items, it's really not a big issue Link to comment Share on other sites More sharing options...
Novak Posted December 4, 2014 Author Share Posted December 4, 2014 Lol my bad, I read it wrong, well IDK what else to say, just find another way to sleep after depositing items, it's really not a big issue but thats not the point, my point is why does it take so long for it to update, this method worked perfect for osb1, it would respond as intended. Link to comment Share on other sites More sharing options...
Czar Posted December 4, 2014 Share Posted December 4, 2014 http://osbot.org/api/org/osbot/rs07/utility/ConditionalSleep.html Use conditional sleep until inventory is empty Link to comment Share on other sites More sharing options...
Novak Posted December 4, 2014 Author Share Posted December 4, 2014 http://osbot.org/api/org/osbot/rs07/utility/ConditionalSleep.html Use conditional sleep until inventory is empty still literally the same thing as OP, it will still be slow cause its using the same .contains method, and the inventory will not be empty after depositing Link to comment Share on other sites More sharing options...
Alek Posted December 4, 2014 Share Posted December 4, 2014 Have you tried the new banking method I added with the release of 2.2.43? http://osbot.org/forum/topic/62310-osbot-2243-combat-magic-and-interface-patches/ bank.withdraw(HashMap<String, Integer>); Link to comment Share on other sites More sharing options...
Czar Posted December 4, 2014 Share Posted December 4, 2014 (edited) Dude it's not the same thing, you just confused me.. if (getInventory().contains(uncut)){ for(int i = 0; i < 100; i++) { sleep(50); } } That is calling inventory.contains 1 time, the code you have calls it 100 times. Try it.. Edited December 4, 2014 by Czar Link to comment Share on other sites More sharing options...
Novak Posted December 4, 2014 Author Share Posted December 4, 2014 Have you tried the new banking method I added with the release of 2.2.43? http://osbot.org/forum/topic/62310-osbot-2243-combat-magic-and-interface-patches/ bank.withdraw(HashMap<String, Integer>); no, but is it really faster than the manual mouse moving I wrote using mouse.move? and does it check to make sure the items have come/left the inventory within 50ms? For some reason it seems really slow to me: depositAll(uncut); for(int i = 0; i < 100 && inventory.contains(uncut); i++) { sleep(50); } is waiting a couple seconds to continue when it should respond within 50ms. Any ideas? Dude it's not the same thing, you just confused me.. if (getInventory().contains(uncut)){ for(int i = 0; i < 100; i++) { sleep(50); } } That is calling inventory.contains 1 time, the code you have calls it 100 times. You just made me look silly -.- Try it.. please explain how it calls it 100 times? the 100 is just for the timeout, if i is less than 100 AND our inventory still contains the item, then sleep for 50. Obviously if the item has left the inventory then the for statement no longer executes because the second condition isn't true. Link to comment Share on other sites More sharing options...
Czar Posted December 4, 2014 Share Posted December 4, 2014 (edited) Mine: Called Sleep Sleep Sleep Sleep Sleep Sleep Sleep Sleep Sleep Sleep Sleep Sleep Sleep Sleep Sleep Sleep Sleep Sleep Sleep Sleep Sleep public boolean contains(int i) { System.out.println("Called"); return true; } public void check() { if (contains(0)) { for (int i = 0; i < 100; i++) { System.out.println("Sleep"); } } } Yours Called Sleep Called Sleep Called Sleep Sleep Called Sleep Called Sleep Called Sleep Called Sleep Called Sleep Called Sleep Called Sleep Called Sleep Sleep Called public boolean contains(int i) { System.out.println("Called"); return true; } public void check() { for (int i = 0; i < 100 && contains(0); i++) { System.out.println("Sleep"); } } Hypothetical, but yeah. Edited December 4, 2014 by Czar Link to comment Share on other sites More sharing options...