Jump to content

Struggling with depositing


Eagle Scripts

Recommended Posts

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,

Link to comment
Share on other sites

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

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

I think something like this would work

if (BANK_AREA.contains(myPlayer())) {

if(inventory.isFull()) {

// We do not assume open always succeeds

if(depositBox.open()) {

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

}

} else {

// deposited stuff, now walk somewhere?

}

}

  • Like 1
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...