Lol_marcus Posted April 22, 2023 Share Posted April 22, 2023 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)); } } } 1 1 Quote Link to comment Share on other sites More sharing options...
Gunman Posted April 22, 2023 Share Posted April 22, 2023 Made some changes Spoiler @Override public int onLoop() throws InterruptedException { if (getInventory().isFull()) { depositInventory(); } else if (getBank().isOpen()) { getBank().close(); } else if (!fishArea.contains(myPosition())) { walkToSpot(); } else { fish(); } return random(200, 300); } private void walkToBank() throws InterruptedException { log("Walking to bank..."); getWalking().webWalk(Banks.DRAYNOR); } private void depositInventory() throws InterruptedException { if (!Banks.DRAYNOR.contains(myPosition())) { walkToBank(); return; } log("Depositing inventory..."); if (getBank().isOpen()) { if (!getInventory().contains(TOOLS) && !getBank().contains(TOOLS)) { log("Tools not found in the bank. Stopping script..."); stop(false); } if (getBank().depositAllExcept(TOOLS)) { Sleep.sleepUntil(() -> getInventory().isEmptyExcept(TOOLS), random(500, 1000)); } if (!getInventory().contains(TOOLS)) { getBank().withdraw("Fishing rod", 1); getBank().withdrawAll("Fishing bait"); Sleep.sleepUntil(() -> getInventory().contains(TOOLS), random(500, 1000)); } } else if (!getBank().open()) { // If I remember correctly open has a built-in sleep log("Failed to open bank..."); } } private void walkToSpot() { log("Walking to fishing spot..."); getWalking().webWalk(fishArea); } private void fish() { log("Fishing..."); final NPC fishingSpot = getNpcs().closest("Fishing spot"); if (fishingSpot == null) { return; } if (fishingSpot.interact("Bait")) { getMouse().moveOutsideScreen(); getBot().getFocusEventHandler().loseFocus(); Sleep.sleepUntil(()-> !fishingSpot.exists() || getInventory().isFull(), random(90_000, 120_000)); } } Quote Link to comment Share on other sites More sharing options...
FuryShark Posted April 22, 2023 Share Posted April 22, 2023 6 minutes ago, Gunman said: Made some changes Hide contents @Override public int onLoop() throws InterruptedException { if (getInventory().isFull()) { depositInventory(); } else if (getBank().isOpen()) { getBank().close(); } else if (!fishArea.contains(myPosition())) { walkToSpot(); } else { fish(); } return random(200, 300); } private void walkToBank() throws InterruptedException { log("Walking to bank..."); getWalking().webWalk(Banks.DRAYNOR); } private void depositInventory() throws InterruptedException { if (!Banks.DRAYNOR.contains(myPosition())) { walkToBank(); return; } log("Depositing inventory..."); if (getBank().isOpen()) { if (!getInventory().contains(TOOLS) && !getBank().contains(TOOLS)) { log("Tools not found in the bank. Stopping script..."); stop(false); } if (getBank().depositAllExcept(TOOLS)) { Sleep.sleepUntil(() -> getInventory().isEmptyExcept(TOOLS), random(500, 1000)); } if (!getInventory().contains(TOOLS)) { getBank().withdraw("Fishing rod", 1); getBank().withdrawAll("Fishing bait"); Sleep.sleepUntil(() -> getInventory().contains(TOOLS), random(500, 1000)); } } else if (!getBank().open()) { // If I remember correctly open has a built-in sleep log("Failed to open bank..."); } } private void walkToSpot() { log("Walking to fishing spot..."); getWalking().webWalk(fishArea); } private void fish() { log("Fishing..."); final NPC fishingSpot = getNpcs().closest("Fishing spot"); if (fishingSpot == null) { return; } if (fishingSpot.interact("Bait")) { getMouse().moveOutsideScreen(); getBot().getFocusEventHandler().loseFocus(); Sleep.sleepUntil(()-> !fishingSpot.exists() || getInventory().isFull(), random(90_000, 120_000)); } } Quote Link to comment Share on other sites More sharing options...
Dextrell Posted August 23 Share Posted August 23 Looks good great job! Would you allow me to add on to this script? I'll give you credits of course Quote Link to comment Share on other sites More sharing options...