I think something like this is more what you're looking for
package core;
import javax.swing.JOptionPane;
import org.osbot.rs07.api.map.constants.Banks;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
@ScriptManifest(name = "Bank Walker", version = 1, author = "Marcus", logo = "", info = "Walks and runs to banks")
public class Main extends Script {
int task;
@Override
public void onStart() throws InterruptedException {
String userOptions[] = {"Varrock", "Falador", "Edgeville"};
String userChoice = ""+(String)JOptionPane.showInputDialog(null, "Choose a location", "Bank Walker", JOptionPane.PLAIN_MESSAGE, null, userOptions, userOptions[1]);
if(userChoice.equals("Varrock")) {
task = 1;
} else if (userChoice.equals("Falador")) {
task = 2;
} else if (userChoice.equals("Edgeville")) {
task = 3;
} else {
stop(false);
}
}
@Override
public int onLoop() throws InterruptedException {
switch (task) {
case 1:
return taskOne();
case 2:
return taskTwo();
case 3:
return taskThree();
}
return 700;
}
public int taskOne() throws InterruptedException {
if (Banks.GRAND_EXCHANGE.contains(myPosition())) {
stop(false);
} else {
combat.toggleAutoRetaliate(false);
getWalking().webWalk(Banks.GRAND_EXCHANGE);
}
return 700;
}
public int taskTwo() throws InterruptedException {
if (Banks.FALADOR_WEST.contains(myPosition())) {
stop(false);
} else {
combat.toggleAutoRetaliate(false);
getWalking().webWalk(Banks.FALADOR_WEST);
}
return 700;
}
public int taskThree() throws InterruptedException {
if (Banks.EDGEVILLE.contains(myPosition())) {
stop(false);
} else {
combat.toggleAutoRetaliate(false);
getWalking().webWalk(Banks.EDGEVILLE);
}
return 700;
}
}