Jump to content

DexAlcher


Dextrell

Recommended Posts

Basic Alch script with a small anti ban cheers!

Put the item you'd like to alch at the far right in the first row the script will high light a box for you where to place it if you're lost

If you want low Alchemy just swap the function call on highAlchemy and it will do that instead!

package com.dexalcher;

import java.awt.Color;
import java.awt.Graphics2D;

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;

@ScriptManifest(name = "DexAlcher", version = 1.0, author = "Dextrell", logo = "", info = "")
public class DexAlcher extends Script {

	private String itemToAlch = "Rune arrow";

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

	public int onLoop() throws InterruptedException {

		int rand = random(0, 200);

		if (rand == 150) {
			log("moving mouse at random...");
			mouse.move(random(0, 2500), random(0, 2500));
		} else if (rand == 0) {
			log("moving mouse off screen...");
			mouse.moveOutsideScreen();
		}

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

	public boolean canAlch() {
		return (getEquipment().isWieldingWeaponThatContains(new String[] { "staff" })
				&& getInventory().contains(new String[] { "Nature rune", itemToAlch }));
	}

	public void clickedAlch() {

		if (!getInventory().contains(itemToAlch)) {
			log("We dont have the items stopping...");
			stop();
		}

		if (!(getTabs()).magic.open()) {
			new ConditionalSleep(600, 800) {
				@Override
				public boolean condition() throws InterruptedException {
					return false;
				}
			};
		}

		new ConditionalSleep(600, 1000) {
			@Override
			public boolean condition() throws InterruptedException {
				clickHighSpellAlchemy();
				return false;
			}
		}.sleep();

		new ConditionalSleep(600, 1000) {
			@Override
			public boolean condition() throws InterruptedException {

				// final RS2Widget itemPic = getWidgets().get(149, 3);
				// int clickX = itemPic.getAbsX() + random(0,6);
				int clickX = random(691, 717);
				int clickY = random(216, 235);
				// int clickY = itemPic.getAbsY() + random(0,6);
				// log("src x: " + itemPic.getAbsX() + " src: " + itemPic.getAbsY());
				// log("Click x: " + clickX + " y: " + clickY);
				mouse.click(clickX, clickY, false);

				log("Finished clicking item...");
				return false;
			}

		}.sleep();

	}

	public boolean clickMagicBook() {

		RS2Widget bookIcon = getWidgets().get(548, 76);
		int clickX = bookIcon.getAbsX() + random(10, 20);
		int clikcY = bookIcon.getAbsY() + random(10, 20);

		return mouse.click(clickX, clikcY, false);
	}

	public void clickLowSpellAlchemy() {
		// RS2Widget alchemyIcon = getWidgets().get(218, 21);
		// int clickX = alchemyIcon.getAbsX() + random(0,5);
		// int clickY = alchemyIcon.getAbsY() + random(0,5);
		int clickX = random(714, 728);
		int clickY = random(233, 247);
		// log("src x: " + alchemyIcon.getAbsX() + " src: " + alchemyIcon.getAbsY());
		mouse.click(clickX, clickY, false);
		// log("alch click x: " + clickX + " clickY: " + clickY);
	}
	
	public void clickHighSpellAlchemy() {
		// RS2Widget alchemyIcon = getWidgets().get(218, 21);
		// int clickX = alchemyIcon.getAbsX() + random(0,5);
		// int clickY = alchemyIcon.getAbsY() + random(0,5);
		int clickX = random(710, 730);
		int clickY = random(305, 320);
		// log("src x: " + alchemyIcon.getAbsX() + " src: " + alchemyIcon.getAbsY());
		mouse.click(clickX, clickY, false);
		// log("alch click x: " + clickX + " clickY: " + clickY);
	}

	public void onPaint(Graphics2D g) {
		int mXp = getExperienceTracker().getGainedXP(Skill.MAGIC);
		super.onPaint(g);
		g.drawString("Magic XP: " + mXp, 387, 328);
		
		g.setColor(Color.CYAN);
		
		g.drawOval((int)mouse.getPosition().getX(), (int)mouse.getPosition().getY(), 10, 10);
		
		if(isInventoryOpen()) {
			g.drawRect(690, 210, 32, 32);
		}
		else {
			//g.drawRect(710, 230, 25, 25);
			g.drawRect(710, 300, 25, 25);
		}
	}
	
	private boolean isInventoryOpen() {
		RS2Widget inventoryWidget = getWidgets().get(149, 0, 3);
		return inventoryWidget != null && inventoryWidget.isVisible();
	}
}

 

Edited by Dextrell
  • Like 1
Link to comment
Share on other sites

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