May 12, 20196 yr 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, 20196 yr by Imthabawse
May 12, 20196 yr 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?
May 12, 20196 yr Author 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.
May 12, 20196 yr 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, 20196 yr by SyntaxRS
May 12, 20196 yr Author 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!
May 13, 20196 yr 52 minutes ago, Imthabawse said: Makes sense. Thanks for the reply! Let me know if that fixed the issue though please :).
May 13, 20196 yr Author 28 minutes ago, SyntaxRS said: Let me know if that fixed the issue though please :). Will do.
Create an account or sign in to comment