Feel free to modify as you wish.
It fishes for sardines and herrings, if you want to make it fish shrimps just change the "Bait" part to "Net", and edit the string to "Fishing net".
package osrs;
import org.osbot.rs07.api.Bank;
import org.osbot.rs07.api.Inventory;
import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.map.constants.Banks;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
@ScriptManifest(name = "Draynor Village Fisher & Banker", author = "Marcus", version = 1.0, info = "Fishes and banks at Draynor", logo = "")
public class Main extends Script {
private final String[] TOOLS = {"Fishing rod", "Fishing bait"};
private Area fishArea = new Area(3084, 3234, 3088, 3224);
@Override
public void onStart() {
log("Starting script...");
}
@Override
public int onLoop() throws InterruptedException {
if (getInventory().isFull()) {
walkToBank();
depositInventory();
} else {
walkToSpot();
fish();
}
return random(200, 300);
}
private void walkToBank() throws InterruptedException {
log("Walking to bank...");
getWalking().webWalk(Banks.DRAYNOR);
}
private void depositInventory() throws InterruptedException {
Bank bank = getBank();
Inventory inventory = getInventory();
log("Depositing inventory...");
if (Banks.DRAYNOR.contains(myPosition())) {
bank.open();
Sleep.sleepUntil(() -> bank.isOpen(), random(500, 1000));
if (!inventory.contains(TOOLS) && !bank.contains(TOOLS)) {
log("Tools not found in the bank. Stopping script...");
stop(false);
}
bank.depositAllExcept(TOOLS);
Sleep.sleepUntil(() -> inventory.isEmptyExcept(TOOLS), random(500, 1000));
if (bank.contains(TOOLS) && !inventory.contains(TOOLS)) {
bank.withdraw("Fishing rod", 1);
bank.withdrawAll("Fishing bait");
Sleep.sleepUntil(() -> getInventory().contains(TOOLS), random(500, 1000));
}
bank.close();
Sleep.sleepUntil(() -> !bank.isOpen(), random(500, 1000));
}
}
private void walkToSpot() throws InterruptedException {
log("Walking to fishing spot...");
getWalking().webWalk(fishArea);
}
private void fish() throws InterruptedException {
log("Fishing...");
NPC fishingSpot = getNpcs().closest("Fishing spot");
if (fishingSpot != null && fishingSpot.exists()) {
fishingSpot.interact("Bait");
sleep(random(1500,2000));
getMouse().moveOutsideScreen();
Sleep.sleepUntil(() -> !myPlayer().isAnimating() || inventory.isFull(), random(90000, 120000));
}
}
}