Jump to content

Herb Ider [Find out what herb it is without Iding]


Recommended Posts

Posted (edited)

So I made this thing, it does what the title says. Hover your mouse over the herb in your inventory or someones trade window to see what it is.

 

EDITED with the new script that supports trade windows.

 

Special thanks to Botrepreneur for the help in dynamically finding the slot being hovered over and making a nice enumerable list of herbs smile.png.

 

Due to popular opinion and request, the script is now back.

Any errors please post here so that I and others may see them. 

 

PLEASE LEAVE A LIKE, FEEDBACK or even a "THX"!!!!

FaysHerbs.zip

Edited by Fay
  • Like 3
Posted

Here's a lil' rewrite, hopefully you'll learn something(s) from it ^^

Gl coding!

import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.util.Arrays;
import java.util.List;

import org.osbot.rs07.api.model.Item;
import org.osbot.rs07.input.mouse.InventorySlotDestination;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

@ScriptManifest(author = "Botrepreneur", info = "HerbIdentifier", name = "HerbIdentifier", version = 0.0, logo = "")
public class HerbIdentifier extends Script {

	private enum Herb {
		GUAM(199, 200),
		MARRENTIL(201, 202),
		TARROMIN(203, 204),
		HARRALANDER(205, 206),
		RANARR(207, 208),
		IRIT(209, 210),
		AVANTOE(211, 212),
		KWUARM(213, 214),
		CANDANTINE(215, 216),
		DWARF_WEED(217, 218),
		TORSOL(219, 220),
		LANTADYME(2485, 2486),
		SNAPDRAGON(3051, 3052);

		private final Integer[] ids;

		private Herb(final Integer... ids) {
			this.ids = ids;
		}

		public List<Integer> getIds() {
			return Arrays.asList(ids);
		}

	}

	@Override
	public int onLoop() throws InterruptedException {
		return Integer.MAX_VALUE;
	}

	public void onPaint(Graphics2D paint) {
		int slot = -1;
		Item item = null;
		Rectangle rectangle = null;
		if (getBot().getClient().isLoggedIn()) {
			Point point = getMouse().getPosition();
			for (int i = 0; i < 28; i++) {
				if ((InventorySlotDestination.getSlot(i)).contains(point)) {
					slot = i;
					break;
				}
			}
			if (slot > -1 && (item = getInventory().getItemInSlot(slot)) != null && item.getDefinition() != null && (rectangle = InventorySlotDestination.getSlot(slot)) != null) {
				int id = item.getId();
				String string = null;
				for (Herb herb : Herb.values()) {
					if (herb.getIds().contains(id)) {
						string = herb.toString();
						break;
					}
				}
				if (string != null) {
					paint.drawString(string, rectangle.x, rectangle.y);
				}
			}
		}
	}
	
}
  • Like 3
Posted

 

Here's a lil' rewrite, hopefully you'll learn something(s) from it ^^

Gl coding!

import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.util.Arrays;
import java.util.List;

import org.osbot.rs07.api.model.Item;
import org.osbot.rs07.input.mouse.InventorySlotDestination;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

@ScriptManifest(author = "Botrepreneur", info = "HerbIdentifier", name = "HerbIdentifier", version = 0.0, logo = "")
public class HerbIdentifier extends Script {

	private enum Herb {
		GUAM(199, 200),
		MARRENTIL(201, 202),
		TARROMIN(203, 204),
		HARRALANDER(205, 206),
		RANARR(207, 208),
		IRIT(209, 210),
		AVANTOE(211, 212),
		KWUARM(213, 214),
		CANDANTINE(215, 216),
		DWARF_WEED(217, 218),
		TORSOL(219, 220),
		LANTADYME(2485, 2486),
		SNAPDRAGON(3051, 3052);

		private final Integer[] ids;

		private Herb(final Integer... ids) {
			this.ids = ids;
		}

		public List<Integer> getIds() {
			return Arrays.asList(ids);
		}

	}

	@Override
	public int onLoop() throws InterruptedException {
		return Integer.MAX_VALUE;
	}

	public void onPaint(Graphics2D paint) {
		int slot = -1;
		Item item = null;
		Rectangle rectangle = null;
		if (getBot().getClient().isLoggedIn()) {
			Point point = getMouse().getPosition();
			for (int i = 0; i < 28; i++) {
				if ((InventorySlotDestination.getSlot(i)).contains(point)) {
					slot = i;
					break;
				}
			}
			if (slot > -1 && (item = getInventory().getItemInSlot(slot)) != null && item.getDefinition() != null && (rectangle = InventorySlotDestination.getSlot(slot)) != null) {
				int id = item.getId();
				String string = null;
				for (Herb herb : Herb.values()) {
					if (herb.getIds().contains(id)) {
						string = herb.toString();
						break;
					}
				}
				if (string != null) {
					paint.drawString(string, rectangle.x, rectangle.y);
				}
			}
		}
	}
	
}

 

Wow, thank you man. I was going to make an enum but I couldn't remember what it was called at 4 am, and I was having alot of trouble with dynamically setting i. This helps out alot :).

  • Like 1
  • 4 weeks later...
Posted

where is the download link?

 

 

Either I'm blind or there is no download link.

 

Since Herbifier isn't working atm, you should add the link. Sounds promising.

 

 

I removed it because 36 people downloaded it and not ONE replied on the topic or said "Nice" or anything. It sucks when people just take your stuff and don't even leave a "Thx". I'll add the revised script up there soon. I currently don't have an account I am willing to sign into the client with as I only have my main so if someone wants to lend me a burner lvl 3 I'd love that too for testing and what not :).

  • Like 2
Posted

where is the download link?

 

 

I'll make a botting account tomorrow, you can use it for testing. Best of luck with the script.

 

 

We needed one of these badly.

 

 

Added the link back. You are all welcome to download it! :) I have not tested this with the newest version but it is compiled with the newest version of OSBot. So shouldn't have any problems.

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