Jump to content

{Beginner} OsBot Local script not appearing


12we12qw12

Recommended Posts

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 :)

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...