Imthabawse Posted May 12, 2019 Share Posted May 12, 2019 (edited) Running into two problems with my Mining script at the moment. Firstly: Spoiler private void bankOre() throws InterruptedException { if(!Banks.VARROCK_EAST.contains(myPosition()) && getInventory().isFull() && !myPlayer().isAnimating() && !getBank().isOpen() && !getDialogues().isPendingContinuation()) { log("Walking to VARROCK_EAST..."); getWalking().webWalk(Banks.VARROCK_EAST); }else if(Banks.VARROCK_EAST.contains(myPosition()) && !getBank().isOpen()) { log("Opening Bank.."); getBank().open(); }else if(getBank().isOpen() && getInventory().contains("Iron ore") && Banks.VARROCK_EAST.contains(myPosition())) { log("Depositing Ore.."); getBank().depositAll("Iron ore"); }else if(getBank().isOpen() && !getInventory().contains("Iron ore") && Banks.VARROCK_EAST.contains(myPosition())) { log("Closing Bank.."); getBank().close(); } } getbank().close; is not being executed... don't understand why. Secondly: Spoiler if(!myPlayer().isAnimating() && !getDialogues().isPendingContinuation() && miningSpot.contains(myPosition()) && ironOre != null && ironOre.interact("Mine")) { log("Mining Ore..."); new ConditionalSleep(5000) { @Override public boolean condition() { return myPlayer().isAnimating(); } }.sleep(); Trying to find a way to make bot interact with another rock if rock I'm mining is taken by another player already Any suggestions would be greatly appreciated Edit: Just removed close; for now. Works fine w/o just wanna understand why it's not executing. Edited May 15, 2019 by Imthabawse Quote Link to comment Share on other sites More sharing options...
Spiderman Posted May 12, 2019 Share Posted May 12, 2019 3 hours ago, Imthabawse said: Running into two problems with my Mining script at the moment. Firstly: Hide contents private void bankOre() throws InterruptedException { if(!Banks.VARROCK_EAST.contains(myPosition()) && getInventory().isFull() && !myPlayer().isAnimating() && !getBank().isOpen() && !getDialogues().isPendingContinuation()) { log("Walking to VARROCK_EAST..."); getWalking().webWalk(Banks.VARROCK_EAST); }else if(Banks.VARROCK_EAST.contains(myPosition()) && !getBank().isOpen()) { log("Opening Bank.."); getBank().open(); }else if(getBank().isOpen() && getInventory().contains("Iron ore") && Banks.VARROCK_EAST.contains(myPosition())) { log("Depositing Ore.."); getBank().depositAll("Iron ore"); }else if(getBank().isOpen() && !getInventory().contains("Iron ore") && Banks.VARROCK_EAST.contains(myPosition())) { log("Closing Bank.."); getBank().close(); } } getbank().close; is not being executed... don't understand why. Secondly: Reveal hidden contents if(!myPlayer().isAnimating() && !getDialogues().isPendingContinuation() && miningSpot.contains(myPosition()) && ironOre != null && ironOre.interact("Mine")) { log("Mining Ore..."); new ConditionalSleep(5000) { @Override public boolean condition() { return myPlayer().isAnimating(); } }.sleep(); Trying to find a way to make bot interact with another rock if rock I'm mining is taken by another player already Any suggestions would be greatly appreciated Edit: Just removed close; for now. Works fine w/o just wanna understand why it's not executing. Is "Closing bank.." shown in logger? Quote Link to comment Share on other sites More sharing options...
Imthabawse Posted May 12, 2019 Author Share Posted May 12, 2019 2 hours ago, SyntaxRS said: Is "Closing bank.." shown in logger? Nope just sits there with bank open. I had it working before I changed up my mining code dunno what would of thrown it off. Quote Link to comment Share on other sites More sharing options...
Spiderman Posted May 12, 2019 Share Posted May 12, 2019 (edited) 47 minutes ago, Imthabawse said: Nope just sits there with bank open. I had it working before I changed up my mining code dunno what would of thrown it off. remove the else if, to simply if statements. Because else will only be executed if the prior if statement is false. So basically what was happening is you weren't at the bank, so the first if statement was true, and therefore it walked to the bank, which then dismissed any other statements because you used " else ", which in simple terms is basically saying if A is not true, then do B, but because A is true, B is dismissed.. private void bankOre() throws InterruptedException { if(!Banks.VARROCK_EAST.contains(myPosition()) && getInventory().isFull() && !myPlayer().isAnimating() && !getBank().isOpen() && !getDialogues().isPendingContinuation()) { log("Walking to VARROCK_EAST..."); getWalking().webWalk(Banks.VARROCK_EAST); } if(Banks.VARROCK_EAST.contains(myPosition()) && !getBank().isOpen()) { log("Opening Bank.."); getBank().open(); } if(getBank().isOpen() && getInventory().contains("Iron ore") && Banks.VARROCK_EAST.contains(myPosition())) { log("Depositing Ore.."); getBank().depositAll("Iron ore"); } if(getBank().isOpen() && !getInventory().contains("Iron ore") && Banks.VARROCK_EAST.contains(myPosition())) { log("Closing Bank.."); getBank().close(); } } Edited May 12, 2019 by SyntaxRS Quote Link to comment Share on other sites More sharing options...
Imthabawse Posted May 12, 2019 Author Share Posted May 12, 2019 32 minutes ago, SyntaxRS said: remove the else if, to simply if statements. Because else will only be executed if the prior if statement is false. So basically what was happening is you weren't at the bank, so the first if statement was true, and therefore it walked to the bank, which then dismissed any other statements because you used " else ", which in simple terms is basically saying if A is not true, then do B, but because A is true, B is dismissed.. private void bankOre() throws InterruptedException { if(!Banks.VARROCK_EAST.contains(myPosition()) && getInventory().isFull() && !myPlayer().isAnimating() && !getBank().isOpen() && !getDialogues().isPendingContinuation()) { log("Walking to VARROCK_EAST..."); getWalking().webWalk(Banks.VARROCK_EAST); } if(Banks.VARROCK_EAST.contains(myPosition()) && !getBank().isOpen()) { log("Opening Bank.."); getBank().open(); } if(getBank().isOpen() && getInventory().contains("Iron ore") && Banks.VARROCK_EAST.contains(myPosition())) { log("Depositing Ore.."); getBank().depositAll("Iron ore"); } if(getBank().isOpen() && !getInventory().contains("Iron ore") && Banks.VARROCK_EAST.contains(myPosition())) { log("Closing Bank.."); getBank().close(); } } Makes sense. Thanks for the reply! Quote Link to comment Share on other sites More sharing options...
Spiderman Posted May 13, 2019 Share Posted May 13, 2019 52 minutes ago, Imthabawse said: Makes sense. Thanks for the reply! Let me know if that fixed the issue though please :). Quote Link to comment Share on other sites More sharing options...
Imthabawse Posted May 13, 2019 Author Share Posted May 13, 2019 28 minutes ago, SyntaxRS said: Let me know if that fixed the issue though please :). Will do. Quote Link to comment Share on other sites More sharing options...
Imthabawse Posted May 15, 2019 Author Share Posted May 15, 2019 @SyntaxRS Confirmed works. Thanks Quote Link to comment Share on other sites More sharing options...