Hello I'm new around here and I'm trying to learn how to script.
I want to give something to the community but I have to learn to code first ;)
My problems:
I have to have a small fishing net in my inventory or it wont open bank and get one
If I have a small fishing net it opens bank then closes then opens and continues like that
private enum State {
FISH, BANK, WAIT
};
private State getState() {
Entity stall = objects.closest("Fishing spot");
if (inventory.isEmpty() && !inventory.contains("Small fishing net"))
return State.BANK;
if (stall != null && inventory.contains("Small fishing net"))
return State.FISH;
return State.WAIT;
}
@Override
public int onLoop() throws InterruptedException {
switch (getState()) {
case FISH:
Entity spot = objects.closest("Fishing spot");
if (spot != null) {
inventory.interact("Use", "Small Fishing Net");
if (inventory.isItemSelected() == true)
spot.interact();
}
break;
case BANK:
Entity bank = objects.closest("Bank booth");
if (!inventory.contains("Small fishing net"))
getBank().withdraw("Small fishing net", 1);
if (bank != null) {
bank.interact("Bank");
sleep(random(500, 700));
getBank().depositAllExcept("Small fishing net");
}
break;
case WAIT:
sleep(random(500, 700));
break;
}
return random(200, 300);
}