Fay Posted August 31, 2014 Posted August 31, 2014 (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 . 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 October 27, 2014 by Fay 3
pitoluwa Posted August 31, 2014 Posted August 31, 2014 Use the for loop, and the code will have 6 lines :P
Botre Posted August 31, 2014 Posted August 31, 2014 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); } } } } } 3
Fay Posted August 31, 2014 Author Posted August 31, 2014 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 . 1
Fay Posted August 31, 2014 Author Posted August 31, 2014 Added in trade windows. Just start the script, turn on mouse input and hover over their item in trade for it to be identified. Also added Toadflax herbs because somehow I forgot it. 1
Titancakes Posted September 28, 2014 Posted September 28, 2014 Either I'm blind or there is no download link. Since Herbifier isn't working atm, you should add the link. Sounds promising.
Fay Posted September 29, 2014 Author Posted September 29, 2014 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 . 2
Titancakes Posted September 29, 2014 Posted September 29, 2014 I'll make a botting account tomorrow, you can use it for testing. Best of luck with the script.
Fay Posted September 30, 2014 Author Posted September 30, 2014 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.