Jump to content

[Open Source] [+Video Tutorial] Lumbridge Cowhide Collector


Zynava

Recommended Posts

Forth script release! 🎉 

Do you like my free scripts? Please show your support: 🙂  ---------------- 👇           Buy Zynava a Coffee!

DISCLAIMER: This script is for EDUCATIONAL PURPOSES ONLY. It is to help other new scripters get an idea of how to approach writing scripts. If you use this script,⚠️you will more than likely face a quick ban in OSRS⚠️. This is a very easy first script to write, but also a very well-known method. Use at your own risk, and most importantly... learn from it. 🙂

VIDEO TUTORIAL:

CODE:

import com.epicbot.api.shared.APIContext;
import com.epicbot.api.shared.GameType;
import com.epicbot.api.shared.entity.GroundItem;
import com.epicbot.api.shared.methods.*;
import com.epicbot.api.shared.model.Area;
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.webwalking.model.RSBank;

import java.awt.*;

@ScriptManifest(name = "Lumbridge Cowhide Collector by Zynava", gameType = GameType.OS)
public class LumbridgeCowHideCollector extends LoopScript {

    /*** BEGIN VARIABLES ***/
    public String status = "";
    public IInventoryAPI myInventory() { return getAPIContext().inventory(); }
    public IWebWalkingAPI webWalking() { return getAPIContext().webWalking(); }
    public IBankAPI myBank() { return getAPIContext().bank(); }
    public ILocalPlayerAPI localPosition() { return getAPIContext().localPlayer(); }
    public IGroundItemsAPI groundItems() { return getAPIContext().groundItems(); }
    public Area COW_AREA = new Area(3244, 3295, 3262, 3277);
    /*** END VARIABLES ***/

    @Override
    public boolean onStart(String... strings) {
        setStatus("Script starting");
        return true;
    }

    @Override
    protected int loop() {
        if(myInventoryIsFull()) {
            setStatus("Heading to bank...");
            bank();
            if(myBank().isOpen()) {
                setStatus("Depositing inventory...");
                if(myBank().depositInventory()) {
                    myBank().close();
                }
            }
        }

        if(!myInventoryIsFull() && !COW_AREA.contains(localPosition().getLocation())) {
            setStatus("Walking to cow field...");
            webWalking().walkTo(COW_AREA.getRandomTile());
        }

        if(!myInventoryIsFull() && COW_AREA.contains(localPosition().getLocation())) {
            GroundItem cowHide = groundItems().query().named("Cowhide").results().nearest();
            if(cowHide != null) {
                setStatus("Gathering cowhide");
                cowHide.interact("Take");
            }
        }
        return 50;
    }

    public boolean myInventoryIsFull() {
        return myInventory().isFull();
    }

    public void bank() {
        webWalking().walkTo(RSBank.LUMBRIDGE_TOP.getTile());
        myBank().open();
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Override
    protected void onPaint(Graphics2D g, APIContext ctx) {
        PaintFrame frame = new PaintFrame("Lumbridge Cowhide Collector by Zynava");
        frame.addLine("Action being performed: ", status);
        frame.draw(g, 0, 170, ctx);
    }
}

 

Edited by Zynava
Updating post with video tutorial. :)
  • Like 3
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.

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