Jump to content

Getting item from the bank


Recommended Posts

Posted

Title tells it all.

I'm using bank.getItem("String")

My code opens the bank, but it just closes it without grabbing what I need, and just repeats itself.

if (!inventory.contains("Small fishing net")) {
			if(banker.isVisible()) {
				camera.toEntity(banker);
				banker.interact("Bank");
				sleep(random(700,1000));
				bank.getItem("Small fishing net");
				sleep(random(500,1000));
				
			} else {
				getWalking().walk(bank_location);
			}

 

I'm not sure if I'm using sleep properly by the way. Could somebody also explain why sleep is needed?

Posted
if (!getInventory().contains("Small fishing net")) {
			if (banker != null && banker.exists) {
				if  (banker.isVisible()) {
				banker.interact("Bank");
				new ConditionalSleep(5000) { // ConditionalSleep will sleep for 5 seconds or until the bank is open
					 public boolean condition() {
                           return getBank().isOpen(); }
                       }.sleep();
				bank.withdraw(1, "Small fishing net");
				new ConditionalSleep(5000) {
					 public boolean condition() {
                           return getInventory().contains("Small fishing net"); }
                       }.sleep()
				
			} else {
				getWalking().walk(bank_location);
}

there might be a few missing brackets }, but u can just add those in

Posted
10 minutes ago, Charlotte said:

getItems(), would get array of items stored in the container.

In this case, you should be using withdraw().

 

derp, thanks bruv.

15 minutes ago, Juggles said:

				bank.getItem("Small fishing net");
That does not withdraw an item

getBank.withdraw("item", amount);

 

Also check if bank is open before withdrawing 

Thanks, I just started to learn to code. I'm not sure what kind of checks I should be doing, there's a lot to think about - _ -

 

Posted
50 minutes ago, kingbutton said:

derp, thanks bruv.

Thanks, I just started to learn to code. I'm not sure what kind of checks I should be doing, there's a lot to think about - _ -

 

It's mostly logic. If you were playing and want to withdraw something from the bank, wouldn't you first wait for the bank to open before withdrawing something? :) That's how it goes

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