Jump to content

Getting item from the bank


kingbutton

Recommended Posts

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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

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