Skip to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Gold Ring Crafter - AlKharid

Featured Replies

This script was made with the intent for the crafting of Gold Rings in AlKharid.
I made this for my own personal use, if you're going to use it then I recommend the following to ensure it works as intended.

  • Start the script in AlKharid
  • Ensure gold bars are visible in the bank
  • Ensure mould is visible in the bank

Download Jar Crafter.jar

For anyone interested the code is below :D
 

package com.shrykur.craft;

import java.util.ArrayList;

import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.map.Position;
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.api.ui.RS2Widget;
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.api.ui.Tab;
import org.osbot.rs07.input.mouse.RectangleDestination;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

@ScriptManifest(author = "Shrykur", info = "Crafting", logo = "", name = "Crafting", version = 0)
public class Node extends Script {

	private Area bankArea;
	private Area furnaceArea;
	private Position position;
	private Boolean isSmelting;
	private Integer level;
	public ArrayList<Integer> items;

	private enum State {
		IN_BANK, BANKING, WALKING, IN_FURNACE, SMELTING;
	}

	@Override
	public void onStart() {
		this.setIsSmelting(false);
		this.setLevel(this.getSkills().getStatic(Skill.CRAFTING));
		items = new ArrayList<>();
		items.add(1592);
		items.add(2357);
		items.add(1635);

		// Setting AlKharid Areas
		this.position = this.myPosition();
		this.setBankArea(new Area(3271, 3162, 3269, 3170));
		this.setFurnaceArea(new Area(3279, 3184, 3274, 3186));
	}

	@Override
	public int onLoop() throws InterruptedException {
		this.position = this.myPosition();
		int chance = random(0, 2500);
		if (this.getLevel() != this.skills.getStatic(Skill.CRAFTING)) {
			this.setLevel(this.getSkills().getStatic(Skill.CRAFTING));
			this.setIsSmelting(false);
			chance = 0;
		}
		if (chance == 0) {
			this.getTabs().open(Tab.SKILLS);
			if (this.widgets.isVisible(320, 13)) {
				RectangleDestination craftingTab = new RectangleDestination(bot, this.widgets.get(320, 13).getBounds());
				this.mouse.move(craftingTab);
				sleep(random(1000, 5000));
				this.getTabs().open(Tab.INVENTORY);
			}
		}
		switch (getState()) {
		case IN_BANK: {
			if (!this.inventory.contains(items.get(0)) || !this.getInventory().contains(items.get(1))) {
				this.getBank().closest().interact("Bank");
			}
			break;
		}
		case BANKING: {
			if (!this.getInventory().contains(items.get(0))) {
				if (this.getBank().contains(items.get(0))) {
					this.getBank().withdraw(items.get(0), 1);
				}
			}
			if (!this.getBank().contains(items.get(1))) {
				stop();
			}
			if (this.getInventory().contains(items.get(2))) {
				this.getInventory().getItem(items.get(2)).interact("Deposit-All");
			}
			if (!this.getInventory().contains(items.get(1))) {
				this.getBank().withdrawAll(items.get(1));
			}
			this.getWalking().webWalk(this.getFurnaceArea());
			break;
		}
		case WALKING: {
			if (!this.myPlayer().isMoving()) {
				if (this.getBankArea().contains(this.closestPositionToPlayer())) {
					this.getWalking().webWalk(this.getBankArea());
				} else {
					if (this.getObjects().closest(1535) != null) {
						RS2Object door = this.getObjects().closest(1535);
						if (door.getPosition().equals(new Position(3279, 3185, 0))) {
							door.interact("Open");
						}
					}
					this.getWalking().webWalk(this.getFurnaceArea());
				}
			}

			break;
		}
		case IN_FURNACE: {
			if (!this.inventory.contains(items.get(1))) {
				this.getWalking().webWalk(this.bankArea);
			}
			if (!this.myPlayer().isAnimating()) {
				Entity furnace = this.getObjects().closest("Furnace");
				while (!furnace.isVisible()) {
					this.getCamera().toEntity(furnace);
				}
				if (furnace.isVisible() && this.getMap().canReach(furnace)) {
					furnace.interact("Smelt");
					sleep(2000);
					RS2Widget bronzeWidget = getWidgets().get(446, 7);
					if (bronzeWidget != null) {
						bronzeWidget.interact("Make-All");
						this.setIsSmelting(true);
					}
				}
			}
			break;
		}
		case SMELTING: {
			if (!this.getInventory().contains(this.items.get(1))) {
				this.setIsSmelting(false);
			}
			break;
		}
		default:

			break;
		}
		return 500;

	}

	private Position closestPositionToPlayer() {
		Position closest_destination = null;
		for (Position p : this.getFurnaceArea().getPositions()) {
			if (closest_destination != null) {
				if (p.distance(this.position) < closest_destination.distance(this.position)) {
					closest_destination = p;
				}
			} else {
				closest_destination = p;
			}
		}
		for (Position p : this.getBankArea().getPositions()) {
			if (closest_destination != null) {
				if (p.distance(this.position) < closest_destination.distance(this.position)) {
					closest_destination = p;
				}
			} else {
				closest_destination = p;
			}
		}
		return closest_destination;

	}

	public State getState() {
		if (this.getBank().isOpen()) {
			return State.BANKING;
		} else if (this.bankArea.contains(position)) {
			return State.IN_BANK;
		} else if (getIsSmelting().equals(true)) {
			return State.SMELTING;
		} else if (this.furnaceArea.contains(position)) {
			return State.IN_FURNACE;
		}
		return State.WALKING;
	}

	public Area getBankArea() {
		return bankArea;
	}

	public void setBankArea(Area bankArea) {
		this.bankArea = bankArea;
	}

	public Area getFurnaceArea() {
		return furnaceArea;
	}

	public void setFurnaceArea(Area furnaceArea) {
		this.furnaceArea = furnaceArea;
	}

	public Boolean getIsSmelting() {
		return isSmelting;
	}

	public void setIsSmelting(Boolean isSmelting) {
		this.isSmelting = isSmelting;
	}

	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}
}

 

Edited by Ricky Dactyl

how much this is making p/h brou?

  • Author
32 minutes ago, Samuxd said:

how much this is making p/h brou?

I actually didn't test how much per hour I was getting, I only made this script with the intent of getting from 5-20 crafting so I could bot sapphire rings, sorry my dude, if I get time tomorrow I'll add an overlay for it to display rings/hour :)

Congrats on the release @Shrykur! I'm looking at this code and I'm like nope... Cba to learn that insane stuff lol

  • Author
12 minutes ago, Hope said:

Congrats on the release @Shrykur! I'm looking at this code and I'm like nope... Cba to learn that insane stuff lol

The usage of states is actually something that I've never worked with before, I thought I'd give it a shot and it turned out to work out allot better than I had hoped, however I'm next looking into Task based scripts, so I'll be delving into that tomorrow ^_^

Edited by Ricky Dactyl

29 minutes ago, Shrykur said:

The usage of states is actually something that I've never worked with before, I thought I'd give it a shot and it turned out to work out allot better than I had hoped, however I'm next looking into Task based scripts, so I'll be delving into that tomorrow ^_^

Best of luck with that ? Better see you with your own script shop one day lol

  • 1 year later...

Nice code! I tried adapting it for gold amulets (u) and for Edgeville but for some reason when I change the banking areas and furnace area I break the code. At first it started continuously running back and forth and then I got it to bank but after withdrawing the bars it didn't go to the furnace. Any tips on how it can be adapted?

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.