Jump to content

bank.depositAll(); and bank.close(); do nothing?


karijuana

Recommended Posts

I'm trying to empty a players inventory into the bank then continue the script, but the above two lines do nothing without error.

if (!inventory.isEmpty()) {		//banks if anything in inventory
   map.walk([sample coords]);           //walk to bank
   bankbooth.interact("Bank");          //open bank
   bank.depositAll();                   //empty inventory into bank
   bank.close();                        //close bank window
}
Edited by karijuana
Link to comment
Share on other sites

 

I'm trying to empty a players inventory into the bank then continue the script, but the above two lines do nothing without error.

if (!inventory.isEmpty()) {		//banks if anything in inventory
   map.walk([sample coords]);           //walk to bank
   bankbooth.interact("Bank");          //open bank
   bank.depositAll();                   //empty inventory into bank
   bank.close();                        //close bank window
}

 

 

You have one conditional, its obvious that this code wouldn't work. You need to first walk the path until your in the bank, then if your in a bank or a bank is near by, you can interact with the bank, then if the bank is open you can deposit all. You are just throwing it all in sequential order, there is no way this should work. If it does it would be completely unstable. 

Link to comment
Share on other sites

You have one conditional, its obvious that this code wouldn't work. You need to first walk the path until your in the bank, then if your in a bank or a bank is near by, you can interact with the bank, then if the bank is open you can deposit all. You are just throwing it all in sequential order, there is no way this should work. If it does it would be completely unstable. 

 

 

if you are scripting like this you better be safe. you should be using more if statement to ensure the safety of the script.

I realize this now, thanks for the advice as it's my first time bot scripting. I need to sleep after each action as well.

Link to comment
Share on other sites

 

I'm trying to empty a players inventory into the bank then continue the script, but the above two lines do nothing without error.

if (!inventory.isEmpty()) {		//banks if anything in inventory
   map.walk([sample coords]);           //walk to bank
   bankbooth.interact("Bank");          //open bank
   bank.depositAll();                   //empty inventory into bank
   bank.close();                        //close bank window
}

 

Try to put everything in a statements, so only 1 action gets ran every loop.

For example:

if(inventory.isFull()){
   if(inbank){
      if(bank.isopen){
         bank.depositAll();
      }else{
         //open bank
      }
   }else{
      //walk bank
   }

}else{
   //whatever u have to do
}

This is way easier to debugg if anything goes wrong and doesn't take as much errors/ memory.

 

Goodluck wink.png

Edited by Khaleesi
  • Like 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...