Jump to content

Bank not closing && Mining [Banking FIXED]


Recommended Posts

Posted (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 by Imthabawse
Posted
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?

Posted (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 by SyntaxRS
Posted
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! 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...