for (int i = 0; i < 53; i++) {
if (!bankArea[i].contains(myPlayer())) {
walking.webWalk(bankArea);
if (bankArea[i].contains(myPosition())) {
} else
if (!getBank().isOpen()); {
getBank().open();
new ConditionalSleep(2000, 100) {
@Override
public boolean condition() throws InterruptedException {
return getInventory().isEmpty();
}
}.sleep();
}
}
}
return random(2000, 500);
why return random(2000,500)? that would simply not work i think, the first param should always be less than the second return(500,2000)
instead of doing for(int i = 0; i < 53, i++) you could simply do for(int i = 0; i < bankArea.size, i++)
And you have done many non logical things here, your logic currently is if bankArea[0] does not contain your player walk to it? so that would probably walk you to everybank, cause to walk to the closest you need to use WebWalkEvent.
Instead of all this just do an object booth and assign to it the closest object with name "Bank Booth" if object is null(as it will be null if you aren't in the bank) u will create a webwalkevent and walk to nearest bank, or else open bank and etc.
As for the ConditionalSleep please check out the docs, and why would you wait for the inventory being empty? instead wait for the bank to be open.
for (int i = 0; i < bankArea.length; i++) {
if (!bankArea[i].contains(myPlayer())) {
WebWalkEvent event = new WebWalkEvent(bankArea);
execute(event);
} else {
if(getBank().isOpen()) {
if(getBank().depositAll()) {
new ConditionalSleep(2000) {
@Override
public boolean condition() throws InterruptedException {
return getInventory().isEmpty();
}
};
}
} else {
if(getBank().open()) {
new ConditionalSleep(2000) {
@Override
public boolean condition() throws InterruptedException {
return getBank().isOpen();
}
};
}
}
}
}
OR
RS2Object bankBooth = getObjects().closest("Bank booth");
if(bankBooth != null) {
if(getBank().isOpen()) {
if(getBank().depositAll()) {
new ConditionalSleep(2000) {
@Override
public boolean condition() throws InterruptedException {
return getInventory().isEmpty();
}
};
}
} else {
if(getBank().open()) {
new ConditionalSleep(2000) {
@Override
public boolean condition() throws InterruptedException {
return getBank().isOpen();
}
};
}
}
} else {
WebWalkEvent event = new WebWalkEvent(bankArea);
execute(event);
}