Jump to content

Banking script issue


Recommended Posts

Posted (edited)

I want it to withdraw food from this array

    public static String[] food = { "Shrimp","Trout","Salmon","Tuna","Lobster","Swordfish","Monkfish","Shark" };

im calling it this way and (may not be the best way but is an example)

if (s.bank.isOpen()){
            //do banking
           if (!s.inventory.contains(food)){
               if (s.getBank().contains(food)){
                    s.bank.withdrawAll(food);
               }
           }

        }

and i get this error

 

ecdae3d3db.png

 

 

i tried fixing it with intelj but this does not work
 

0669071121.png

Edited by Sinatra
Posted

I want it to withdraw food from this array

    public static String[] food = { "Shrimp","Trout","Salmon","Tuna","Lobster","Swordfish","Monkfish","Shark" };

im calling it this way

if (s.bank.isOpen()){
            //do banking
           if (!s.inventory.contains(food)){
               if (s.getBank().contains(food)){
                    s.bank.withdrawAll(food);
               }
           }

        }

and i get this error

 

ecdae3d3db.png

 

 

i tried fixing it with intelj but this does not work

 

0669071121.png

 

You are passing an array to a method that only takes a String parameter.

 

b5bc93bc8d7963411b64c71a5b1f840c.png

 

Possible solution:

for(String f; food) {

if(!getBank().contains(f)) continue;

else {
getBank().withdrawAll(f);
break;
}

}
Posted

Slow stepping.

Find item using item container.

Item item = Bank.getItem (food);

Bank.withdrawAll(item.getName ());

Just do a null check on the item.

hmm okay ill work with this and thanks for the fast response :wub:

  

You are passing an array to a method that only takes a String parameter.

 

b5bc93bc8d7963411b64c71a5b1f840c.png

 

Possible solution:

for(String f; food) {

if(!getBank().contains(f)) continue;

else {
getBank().withdrawAll(f);
break;
}

}

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