Reminiscence Posted January 6, 2018 Share Posted January 6, 2018 (edited) Automatically levels you up from 1-99. No need to configure, goes based off of skill level. http://www.mediafire.com/file/cxrff1log2cz9d4/fletchy.jar 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 = "Fletchy", author = "Sonysi", version = 1.0, info = "", logo = "") public class Fletchy extends Script { long timeElapsed, startTime; String currentToDo, state = "", knife = "Knife", requiredLogs; @Override public void onStart() { experienceTracker.start(Skill.FLETCHING); startTime = System.currentTimeMillis(); } @Override public void onExit() { log("Exp gained: " + experienceTracker.getGainedXP(Skill.FLETCHING)); log("Levels gained: " + experienceTracker.getGainedLevels(Skill.FLETCHING)); } void whatToCut() { if (skills.getDynamic(Skill.FLETCHING) < 10) { requiredLogs = "Logs"; currentToDo = "Arrow shafts"; } if (skills.getDynamic(Skill.FLETCHING) >= 10 && skills.getDynamic(Skill.FLETCHING) < 20) { requiredLogs = "Logs"; currentToDo = "Longbows"; } if (skills.getDynamic(Skill.FLETCHING) >= 20 && skills.getDynamic(Skill.FLETCHING) < 25) { requiredLogs = "Oak logs"; currentToDo = "Oak shortbows"; } if (skills.getDynamic(Skill.FLETCHING) >= 25 && skills.getDynamic(Skill.FLETCHING) < 35) { requiredLogs = "Oak logs"; currentToDo = "Oak longbows"; } if (skills.getDynamic(Skill.FLETCHING) >= 35 && skills.getDynamic(Skill.FLETCHING) < 40) { requiredLogs = "Willow logs"; currentToDo = "Willow shortbows"; } if (skills.getDynamic(Skill.FLETCHING) >= 40 && skills.getDynamic(Skill.FLETCHING) < 50) { requiredLogs = "Willow logs"; currentToDo = "Willow longbows"; } if (skills.getDynamic(Skill.FLETCHING) >= 50 && skills.getDynamic(Skill.FLETCHING) < 55) { requiredLogs = "Maple logs"; currentToDo = "Maple shortbows"; } if (skills.getDynamic(Skill.FLETCHING) >= 55 && skills.getDynamic(Skill.FLETCHING) < 70) { requiredLogs = "Maple logs"; currentToDo = "Maple longbows"; } if (skills.getDynamic(Skill.FLETCHING) >= 70 && skills.getDynamic(Skill.FLETCHING) < 99) { requiredLogs = "Yew logs"; currentToDo = "Yew longbows"; } state = "Checking stats"; } @Override public int onLoop() throws InterruptedException { if (grandExchange.isOpen()) { grandExchange.close(); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return !grandExchange.isOpen(); } }.sleep(); } if (requiredLogs == null) { whatToCut(); } if (dialogues.isPendingContinuation()) { //Utilities.takeScreenshot(); dialogues.clickContinue(); } if (!inventory.contains(requiredLogs) || !inventory.contains(knife)) { if (!bank.isOpen()) { state = "opening bank"; bank.open(); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return bank.isOpen(); } }.sleep(); } if (bank.isOpen()) { if ((!inventory.contains(knife) || !inventory.contains(requiredLogs)) && !inventory.isEmpty()) { state = "Depositing"; bank.depositAllExcept(knife); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return inventory.onlyContains(knife); } }.sleep(); } if (!inventory.contains(knife)) { state = "Withdrawing knife"; bank.withdraw(knife, 1); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return inventory.contains(knife); } }.sleep(); } if (!inventory.contains(requiredLogs)) { whatToCut(); log(requiredLogs); state = "Withdrawing " + requiredLogs; bank.withdraw(requiredLogs, 27); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return inventory.contains(requiredLogs); } }.sleep(); } } } if (bank.isOpen() && !bank.contains(requiredLogs)) { logoutTab.logOut(); stop(); } if (bank.isOpen()) { if (inventory.contains(knife) && inventory.contains(requiredLogs)) { state = "Closing bank"; bank.close(); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return !bank.isOpen(); } }.sleep(); } } if (inventory.contains(knife) && inventory.contains(requiredLogs) && !bank.isOpen()) { if (!isAnimating()) { if (widgets.get(270, 16, 38) == null) { state = "Interacting"; inventory.interact("Use", knife); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return inventory.isItemSelected(); } }.sleep(); state = "Cutting"; inventory.interact("Use", requiredLogs); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return widgets.get(270, 16, 38) != null; } }.sleep(); } if (widgets.get(270, 16, 38) != null) { if (currentToDo == "Arrow shafts") { widgets.get(270, 14, 38).interact(); } if (currentToDo == "Longbows") { widgets.get(270, 17, 38).interact(); } if (currentToDo == "Oak shortbows" || currentToDo == "Willow shortbows" || currentToDo == "Maple shortbows") { widgets.get(270, 15, 38).interact(); } if (currentToDo == "Oak longbows" || currentToDo == "Willow longbows" || currentToDo == "Maple longbows" || currentToDo == "Yew longbows") { widgets.get(270, 16, 38).interact(); } sleep(); } } } return 100; } void sleep() throws InterruptedException { new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return !isAnimating() && !inventory.contains(requiredLogs); } }.sleep(); } boolean isAnimating() { for (int i = 0; i < 300; i++) { if (players.myPlayer().isAnimating()) { return true; } } return false; } private final RenderingHints antialiasing = new RenderingHints( RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); private final Color color1 = new Color(0, 0, 0, 205); private final Color color2 = new Color(0, 0, 0); private final Color color3 = new Color(255, 255, 255); private final BasicStroke stroke1 = new BasicStroke(1); private final Font font1 = new Font("Arial", 0, 12); public String formatTime(final long time) { final int sec = (int) (time / 1000), h = sec / 3600, m = sec / 60 % 60, s = sec % 60; return (h < 10 ? "0" + h : h) + ":" + (m < 10 ? "0" + m : m) + ":" + (s < 10 ? "0" + s : s); } public void onPaint(Graphics2D g) { timeElapsed = System.currentTimeMillis() - startTime; g.setRenderingHints(antialiasing); g.setColor(color1); g.fillRect(330, 260, 185, 78); g.setColor(color2); g.setStroke(stroke1); g.drawRect(330, 260, 185, 78); g.setFont(font1); g.setColor(color3); g.drawString("EXP: " + experienceTracker.getGainedXP(Skill.FLETCHING), 333, 275); g.drawString("EXP/Hour: " + experienceTracker.getGainedXPPerHour(Skill.FLETCHING), 333, 290); g.drawString("Levels: " + experienceTracker.getGainedLevels(Skill.FLETCHING), 333, 305); g.drawString("State: " + state, 333, 320); g.drawString("Runtime: " + formatTime(timeElapsed), 333, 335); } } Edited January 6, 2018 by Sonysi 4 Quote Link to comment Share on other sites More sharing options...
progamerz Posted January 6, 2018 Share Posted January 6, 2018 Good release Quote Link to comment Share on other sites More sharing options...
Septron Posted January 6, 2018 Share Posted January 6, 2018 format your data into enums so it's easier to manage/update private enum Product { ARROW_SHAFT("Logs", 270, 14, 38); private final String log; private final int[] widget; Product(String log, int... widget) { this.log = log; this.widget = widget; } } private RS2Widget getWidget(Product product) { return getWidgets().get(product.widget[0], product.widget[1], product.widget[2]); } then you can simplify that ugly if else method a bit int level = skills.getDynamic(Skill.FLETCHING); if (level >= 70) { } else if (level >= 55) { } else if (level >= 50) { } else if (level >= 40) { } else if (level >= 35) { } else if (level >= 25) { } else if (level >= 10) { } else { return ARROW_SHAFT; } do yourself a favor and simplify those nasty ConditionalSleeps public boolean sleep(int ms, BooleanSupplier supplier) { return new ConditionalSleep(ms) { @Override public boolean condition() throws InterruptedException { return supplier.getAsBoolean(); } }.sleep(); } sleep(5000, () -> bank.isOpen()); 2 Quote Link to comment Share on other sites More sharing options...
H0rn Posted February 13, 2018 Share Posted February 13, 2018 boolean isAnimating() { for (int i = 0; i < 300; i++) { if (players.myPlayer().isAnimating()) { return true; } } return false; } Please? What is that even for Quote Link to comment Share on other sites More sharing options...
Prolax Posted February 20, 2018 Share Posted February 20, 2018 On 14-2-2018 at 12:18 AM, H0rn said: boolean isAnimating() { for (int i = 0; i < 300; i++) { if (players.myPlayer().isAnimating()) { return true; } } return false; } Please? What is that even for I don't understand that one either. No need for that for loop + no need to create your own isAnimating method. Quote Link to comment Share on other sites More sharing options...
FoofyKin Posted March 23, 2018 Share Posted March 23, 2018 Would be a nice addition if you made the cursor visible to see what it was doing and if it can be set to move off screen, otherwise I like it Quote Link to comment Share on other sites More sharing options...
Destrupt Posted March 23, 2018 Share Posted March 23, 2018 Dope idea, would be interesting to see if a bot could get 1-99 w/o ban with this. Fletching seems to get me banned asap in past experience, will never bot fletching ever again lmfao. Quote Link to comment Share on other sites More sharing options...