Jump to content

Struggling with depositing


Recommended Posts

Posted

So I'm trying to let my script deposit all except *something*, if in the deposit box's area.

It opens the deposit box, so that's good.
It doesn't deposit all except *something*, it deposits everything
Even though i'm telling it to deposit except certain items, so this is why I'm asking for help what I should do so it deposits all but certain items.

My code so far :

case BANK:
			if (inventory.isFull() && BANK_AREA.contains(myPlayer()));
			Entity BANK = objects.closest("Bank deposit box");
            log("Bank deposit box null?: " + (BANK == null));
                log("Bank deposit box has Deposit action: " + BANK.hasAction("Deposit"));
                if (!depositBox.isOpen()) {
                    if (depositBox != null) {
                        if (depositBox.open())
                            sleep(random(1000, 3000));
                        }
                    } else if (!inventory.isEmpty()) {
                    if (depositBox.depositAllExcept("Lobster pot, Coins, coins, Harpoon")) sleep(1000);

                    }

Thanks in advance,

Posted (edited)

depositBox.depositAllExcept("Lobster pot", "Coins", "coins", "Harpoon")

It takes an array (or varargs) of strings wink.png

Also:

if (!depositBox.isOpen()) {

if (depositBox != null) {

if (depositBox.open())

sleep(random(1000, 3000));

}

}

depositBox won't be null if you successfully called depositBox.isOpen() right? tongue.png

depositBox.open() checks if it's already open, so no need to double check that

Edited by Flamezzz
Posted (edited)

depositBox.depositAllExcept("Lobster pot", "Coins", "coins", "Harpoon")

It takes an array (or varargs) of strings wink.png

Also:

if (!depositBox.isOpen()) {

if (depositBox != null) {

if (depositBox.open())

sleep(random(1000, 3000));

}

}

depositBox won't be null if you successfully called depositBox.isOpen() right? tongue.png

depositBox.open() checks if it's already open, so no need to double check that

 

So what would the new full case bank be? biggrin.png

Edited by ragfr00b

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...