Jump to content

{Beginner} OsBot Local script not appearing


Recommended Posts

Posted

Take a look at this example script

Spoiler

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;
import org.osbot.rs07.utility.ConditionalSleep;


@ScriptManifest(author = "Imthabawse", info = "Catches Shrimps and Banks when full", logo = "", name = "Shrimper", version = 1)

public class Shrimper extends Script {


    private Area fishingArea = new Area(3239, 3142, 3245, 3155);



    @Override
    public int onLoop() throws InterruptedException {
    if(canFish()) {
        catchShrimp();
    }else{
        bankShrimp();
    }
        return(random(500,750));
    }



    private boolean canFish() {
        return !getInventory().isFull() && getInventory().contains("Small fishing net") && !getBank().isOpen();
    }

    private boolean readyToCatch() {
        return !myPlayer().isAnimating() && fishingArea.contains(myPlayer());
    }

    private void catchShrimp() throws InterruptedException {
        NPC netSpot = getNpcs().closest(fishingArea,"Fishing spot");

        if(!getDialogues().isPendingContinuation() && readyToCatch() && netSpot != null && netSpot.interact("Net")) {
            log("Shrimpin!");
            sleep(random(1200,1350));
            getMouse().moveOutsideScreen();
            new ConditionalSleep(5000) {
                @Override
                public boolean condition() {
                    return myPlayer().isAnimating();
                }
            }.sleep();
        }else if(!fishingArea.contains(myPlayer())) {
            log("Walking back to fishing area..");
            getWalking().webWalk(fishingArea);
        }else if(getDialogues().isPendingContinuation()) {
            sleep(random(550,750));
            getDialogues().clickContinue();
        }
    }


    private void bankShrimp() throws InterruptedException {
        if(getInventory().isFull() && !myPlayer().isAnimating() && !Banks.LUMBRIDGE_UPPER.contains(myPlayer())) {
            log("Walking to bank..");
            getWalking().webWalk(Banks.LUMBRIDGE_UPPER);
        }else if(!getBank().isOpen() && Banks.LUMBRIDGE_UPPER.contains(myPlayer())) {
            log("Banking Shrimps..");
            getBank().open();
        }else if(getInventory().contains("Raw shrimps","Raw anchovies")) {
            getBank().depositAll("Raw shrimps","Raw anchovies");
        }else if(!getInventory().contains("Raw shrimps","Raw anchovies")) {
            getBank().close();
        }
    }
}

Make sure you have all the right imports and also in Project structure under Artifacts you have your JAR Output directory set to OSbot\Scripts 

If you need further help check this out:

Will teach you everything you need to get started. Hope this helps :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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