ElChapoJr 15 Share Posted August 8, 2017 So I made a check to see if banking is selected and if it is it runs this code. However, the player will begin to move to the bank, but he will never make it, and the Calculations.random runs out and he returns to what he was suppose to be doing. if (gui.itempref() == "Bank") { if(getInventory().isFull()) { getWalking().walk(getBank().getClosestBankLocation().getCenter()); dobanking(); sleepUntil(() -> (Lumbridge.contains(getLocalPlayer())), Calculations.random(35000, 40000)); } } Here is the dobanking(); method private void dobanking() { log("Checking To See If Banking Needed"); NPC banker = getNpcs().closest(npc -> npc != null && npc.hasAction("Bank")); if (banker != null && banker.interact("Bank")) { if(sleepUntil(() -> getBank().isOpen(), 9000)){ getBank().depositAllItems(); if(sleepUntil(() -> !getInventory().isFull(), 8000)){ if (getBank().close()) { sleepUntil(() -> !getBank().isOpen(), 8000); } } } Link to comment Share on other sites More sharing options...
Nuclear Nezz 2056 Share Posted August 8, 2017 First of all on objects you should use .equals, not == (strings are objects) I don't even know what you're trying to do, or "what he was supposed to be doing" is. walk does not walk you the whole way there all in one go, it clicks on the next tile in the path and returns. Overall your logic in the snippet is just not correct. You should try to avoid doing a bunch of actions all at once, and instead have it sectioned off if(inventory is full){ if( not in bank){walk to bank;} else bank}then the loop will take care of the iteration over the logic and you'll be able to 1. debug it more effectively as it's sectioned off 2. it will work more reliably. Link to comment Share on other sites More sharing options...
ElChapoJr 15 Author Share Posted August 8, 2017 Alright, I applied what you told me to and it seemed to take care of the banking issue. Thanks for showing me Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.