Jump to content

Simple Barbarian Fisher (Leaping trout, salmon, sturgeon)


Imthabawse

Botting & Bans  

10 members have voted

  1. 1. Do you think sharing code on the website can potentially help Jagex in preventing bots?

    • Yes.
      1
    • No.
      7
    • Maybe... Idfk.
      2


Recommended Posts

Simple script I whipped up to gain some levels on one of my accounts figured id share and throw in some comments to help newer scripters.

To start script you'll need

Barbarian rod

Feather

Games necklace Equip (Optional, faster travel time)

 

You can start the script from anywhere. 

Script will fish and drop when inventory is full. 

Code below ?

import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.ui.EquipmentSlot;
import org.osbot.rs07.api.ui.Tab;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;

// ScriptManifest allows your script to show up in OsBot's script selector
@ScriptManifest(name = "Barbfisher", logo = "", version = 1, author = "Imthabawse", info = "Fishes and drops at barb outpost")



public class Barbfisher extends Script {

    // Creates the area in which we will be fishing

    private Area fisharea = new Area(2499, 3496, 2506, 3520);
    private Area telearea = new Area(2527, 3580, 2515, 3561);
    // Our fishing method

    private void fish() {
        Entity fishingspot = getNpcs().closest("Fishing spot"); // Gets closest "Fishing spot" to our player

        // If our inventory contains the required items to fish and player is not (!) animating/moving, inventory isnt full, and fishingspot exists (!=)
        if(getInventory().contains("Barbarian rod" , "Feather") && !myPlayer().isAnimating() && !myPlayer().isMoving() && !getInventory().isFull() && fishingspot != null) {
            log("Fishing..."); // Shows up in Osbot logger to help debug errors
            fishingspot.interact("Use-rod"); // Interact with fishing spot if above condition met
            new ConditionalSleep(5000) { // Sleep 5 seconds
    @Override
    public boolean condition() {
        return myPlayer().isAnimating(); // Stop sleeping before timeout if player is animating (fishing)
    }
}.sleep(); // Call the sleep
        log("Moving mouse off-screen...");
            getMouse().moveOutsideScreen(); // Moves mouse outside screen
        }
    }

    // Our drop method

    private void drop() {
        // If inventory is full etc..
        if(getInventory().isFull() && !myPlayer().isAnimating() && !myPlayer().isMoving()) {
            log("Dropping fish...");
            // Drops all except items listed
            getInventory().dropAllExcept("Barbarian rod","Feather","Stamina potion(3)");

        }
    }

    // Only called once at start of script
    @Override
    public void onStart() {
        log("Welcome to Barbarian fisher.. enjoy the exp!");
    }

    // Only called when script exits
    @Override
    public void onExit() {
        log("Thanks for using Barbarian fisher.. remember take breaks frequently! don't wanna get banned.");
    }

    // Loops methods inside over and over
    @Override
    public int onLoop() throws InterruptedException {
        // If were in fishing area we want to catch fish/drop fish
        if(fisharea.contains(myPlayer())) {
            fish();
            drop();
        }else {
            // Otherwise we need to get to fishing area
            if (!fisharea.contains(myPlayer()) && !getEquipment().isWearingItemThatContains(EquipmentSlot.AMULET, "Games necklace(1)", "Games necklace(2)", "Games necklace(3)", "Games necklace(4)", "Games necklace(5)", "Games necklace(6)", "Games necklace(7)", "Games necklace(8)")) {
                // Walks to fishing area from anywhere in Runescape
                getWalking().webWalk(fisharea);
            } else if (!fisharea.contains(myPlayer()) && !telearea.contains(myPlayer()) && !myPlayer().isAnimating() && getEquipment().isWearingItemThatContains(EquipmentSlot.AMULET, "Games necklace(1)", "Games necklace(2)", "Games necklace(3)", "Games necklace(4)", "Games necklace(5)", "Games necklace(6)", "Games necklace(7)", "Games necklace(8)")) {
                log("Teleporting.. screw walking...");
                getEquipment().interact("Barbarian outpost", "Games necklace(1)", "Games necklace(2)", "Games necklace(3)", "Games necklace(4)", "Games necklace(5)", "Games necklace(6)", "Games necklace(7)", "Games necklace(8)");
                sleep(random(300,600));
                getTabs().open(Tab.INVENTORY);
            } else if (telearea.contains(myPlayer())) {
                    getWalking().webWalk(fisharea);
                }
            }


        return 1000; // Loop every 1 second
    }
}
Edited by Imthabawse
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...