stop() would work - states are really just a framework of if statements that help you structure the script, like this:
private enum State {
COMBAT, WALK_TO_FIGHT_AREA, WALK_TO_BANK, OPEN_BANK, BANK, LOG_OUT
};
private State getState() {
if(getInventory().contains("Salmon")) {
if(!fightArea.contains(myPlayer())
return State.WALK_TO_FIGHT_AREA;
if(getCombat().isFighting())
return State.COMBAT;
return State.ATTACK_GUARD;
}
if(!bankArea.contains(myPlayer()))
return State.WALK_TO_BANK;
if(!getBank().isOpen())
return State.OPEN_BANK;
if(getBank().contains("Salmon"))
return State.BANK;
return State.LOG_OUT;
}
public int onLoop() {
switch(getState()) {
case COMBAT:
//combat with guard
break;
case ATTACK_GUARD:
//attack guard
break;
case BANK:
break;
case WALK_TO_BANK:
getWalking().webWalk(bankArea);
break;
//other states that you have go here, implement code into each one
}
}
this is a simple example of how you might use a state system with this script - it helps to clean up the script, so it's a lot easier to debug
would also recommend looking at a few tutorials on starting scripting, like APAs tea stealing script.