Jump to content

Bank not closing && Mining [Banking FIXED]


Imthabawse

Recommended Posts

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
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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! 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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