Jump to content

Simple Alcher


Recommended Posts

Posted
import org.osbot.rs07.api.ui.RS2Widget;
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;

import java.awt.*;

@ScriptManifest(name = "HiAlch", version = 1, author = "J$", logo = "", info = "")

public class Main extends Script {

    @Override
    public void onStart() throws InterruptedException {
        getExperienceTracker().start(Skill.MAGIC);
    }

    @Override
    public int onLoop() throws InterruptedException {

        if (canAlch()) {
            clickAlch();
        } else {
            stop();
            log("Out of supplies or dead");
        }
        return 700;
    }

    public boolean canAlch() {
        return getEquipment().isWieldingWeaponThatContains("staff") &&
                getInventory().contains("Nature rune", "Yew longbow (u)");
    }

    public void clickAlch() {
        RS2Widget[] alchPic = getWidgets().getWidgets(218, 35);
        int rX = random(705, 717);
        int rY = random(331, 338);

        if (getTabs().magic.open()) {
            getMouse().click(rX, rY, false);
            getMouse().click(rX, rY, false);
            new ConditionalSleep(2000, 500) {
                @Override
                public boolean condition() throws InterruptedException {
                    return alchPic != null;
                }
            }.sleep();
        }
    }

    @Override
    public void onPaint(Graphics2D paint) {
        int mXp = getExperienceTracker().getGainedXP(Skill.MAGIC);

        super.onPaint(paint);
        paint.drawString("Magic XP: " + mXp, 387, 328);
    }
}

I was working on an Agility Alcher and decided to make this while bank standing. If you can use it, sweet, if it's bad, sorry. 

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