Jump to content

Osrs Potato Picker


ashgg83

Recommended Posts

Basic Potato picking script, should help with simple tasks.

unknown.png

 

import com.epicbot.api.shared.APIContext;
import com.epicbot.api.shared.GameType;
import com.epicbot.api.shared.entity.SceneObject;
import com.epicbot.api.shared.model.Area;
import com.epicbot.api.shared.model.Tile;
import com.epicbot.api.shared.script.LoopScript;
import com.epicbot.api.shared.script.ScriptManifest;
import com.epicbot.api.shared.util.paint.frame.PaintFrame;
import com.epicbot.api.shared.util.time.Time;
import com.epicbot.api.shared.webwalking.model.RSBank;

import java.awt.*;

@ScriptManifest(name = "Private Potato Picker", gameType = GameType.OS)
public class main extends LoopScript {

    private Area BANK_AREA = new Area(new Tile(3087, 3247, 0), new Tile(3098, 3239, 0));
    private Area POTATO_AREA = new Area(new Tile(3137, 3291, 0), new Tile(3158, 3267, 0));

    private long startTime;
    private int counter = 0;

    @Override
    public boolean onStart(String... strings) {
        startTime = System.currentTimeMillis();
        return true;
    }

    @Override
    protected int loop() {
        if (getAPIContext().inventory().isFull()) {
            bank();
        } else {
            mine();
        }
        return 100;
    }

    private void bank() {
        if (!BANK_AREA.contains(getAPIContext().localPlayer().getLocation())) {
            getAPIContext().webWalking().walkTo(RSBank.DRAYNOR.getTile());

        } else {

            if (BANK_AREA.contains(getAPIContext().localPlayer().getLocation())) {
                if (!getAPIContext().bank().isOpen()) {
                    getAPIContext().bank().open();
                    Time.sleep(5_000, () -> getAPIContext().bank().isOpen());
                }

            }
            if (getAPIContext().bank().isOpen())   {
                getAPIContext().bank().depositInventory();
            }
            
        }
    }


    private void mine() {
        if (!POTATO_AREA.contains(getAPIContext().localPlayer().getLocation())) {
            getAPIContext().webWalking().walkTo(POTATO_AREA.getCentralTile());
        } else if (!isActioning()) {
            final SceneObject potato = getAPIContext().objects().query().nameContains("Potato").results().nearest();
            if (potato != null) {
                if (potato.interact("Pick")) {
                    counter++;
                    Time.sleep(5_000, () -> getAPIContext().localPlayer().isAnimating());

                }
            }
        }
    }

    @Override
    protected void onPaint(Graphics2D g, APIContext ctx){
        PaintFrame pf = new PaintFrame();
        pf.setTitle(">>>Private Potato Picker<<<    ");
        pf.addLine("Runtime: ", Time.getFormattedRuntime(startTime));
        //pf.addLine("Mining Level: ", getAPIContext().skills().mining().getCurrentLevel());
        pf.addLine("Potatoes Picked: ", counter);
        pf.draw(g, 0, 90, ctx);

    }


    private boolean isActioning() {
        return getAPIContext().localPlayer().isAnimating() || getAPIContext().localPlayer().isMoving();
    }

    private int getGainedLevels() {
        return getAPIContext().skills().thieving().getCurrentLevel();
    }

}

 

  • Like 2
Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

×
×
  • Create New...