Jump to content
JS3

Simple Alcher

Recommended Posts

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. 

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.



  • Recently Browsing   0 members

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