Jump to content

Can someone show me the proper way to bank and withdraw my items?


Recommended Posts

Posted

This is what i am using to bank and withdraw my items, it works but i know its not the proper way. 

This is what i use :

 

 	if (chestArea.contains(myPosition()) & !getBank().isOpen() & !getInventory().contains(bankItems)) {
    		getObjects().closest("Bank chest").interact("Use");
                new ConditionalSleep(5000) { 						// If in bank area and bank isnt open and inventory contains -
				 public boolean condition() {						// certain items, open the bank.
                      return getBank().isOpen(); }
                  }.sleep();}

    	else
    		log("Banking");
                 
                  if (getBank().contains(amuletFilter)) {					//If the bank contains amulet then -
                	  bank.depositAll();									// deposit everything
                	  inventItems.forEach((e) -> bank.withdraw(e, 1));		// withdraw my array of items	
                	  getBank().withdraw(amuletFilter, 1);					// withdraw amulet
                	  getBank().withdraw(duelRing, 1);						// withdraw ring
                	  if (!getEquipment().isWearingItem(EquipmentSlot.RING, "Ring of wealth")) { 		// if im not wearing a ring of wealth then
                		  getBank().withdraw(ringOfWealth, 1);											// withdraw a ring of wealth aswell as the other items
                	  }
                	    getBank().close();									//close the bank
                	} else {
                	    log("Out of supplies!");     						//else if any of that is not possible, stop script.
                	    stop();
                	}

 

Posted (edited)

You want to check if your the bank contains your players position in a separate if statement, so you can else it with a walk to bank function and nest the isopen() check inside that.

if(bank.contains(myPlayer())){

    if(bank.isopen()){

        depositall();

    }

    else

        openbank();

}

else

    walktobank();

 

also for withdrawing items I would just type the string of the item name, unless you have a reason for it? 

getBank().withdraw("Ring of dueling", 1);
Edited by Cloxygen

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