Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Draynor Village Fisher/Banker [Open Source]

Featured Replies

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));
        }
    }
}

 

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));
        }
    }

 

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));
        }
    }

 

Ic4TyiE.png

  • 1 year later...

Looks good great job! Would you allow me to add on to this script? I'll give you credits of course

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.