ItsYaBoiEd Posted January 15, 2021 Share Posted January 15, 2021 (edited) I have got to let you know that this is my first time trying to do anything even closely related to programming, so don't expect anything crazy. This is just a simple flax picker that picks flax, goes to spin the flax into bowstrings and then banks them. After that its on repeat. I created this because I am running a Youtube series about botting my ironman account and I really wanted to do bowstrings to alch the bows later. No way was I gonna do it by hand - that's why this script was created. Start the script anywhere near Seers Village. If you want to be safe, start it in the bank to be sure. Make sure you have an empty inventory before running it. From my own testing the script runs without any issues. If you do encounter any - please let me know! import com.epicbot.api.shared.APIContext; import com.epicbot.api.shared.GameType; import com.epicbot.api.shared.entity.Player; import com.epicbot.api.shared.entity.SceneObject; import com.epicbot.api.shared.entity.WidgetChild; import com.epicbot.api.shared.entity.WidgetGroup; import com.epicbot.api.shared.model.Area; import com.epicbot.api.shared.model.Tile; import com.epicbot.api.shared.script.LoopScript; import com.epicbot.api.shared.script.ScriptManifest; import com.epicbot.api.shared.util.paint.frame.PaintFrame; import com.epicbot.api.shared.util.time.Time; import sun.security.action.GetBooleanAction; import javax.imageio.ImageIO; import java.awt.*; import java.awt.image.BufferedImage; import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; @ScriptManifest(name = "Ed's Kush Picker", gameType = GameType.OS) public class main extends LoopScript { private final Area flaxField = new Area(2751, 3437, 2739, 3451); private final Area seersBank = new Area(2729, 3490, 2721, 3493); private Player local; private SceneObject flax; private final Tile spinRoom = new Tile(2771, 3471, 1); private SceneObject spinningWheel; private final Tile ladderTile = new Tile(2715, 3471, 0); private final Area stairRoom = new Area(2711, 3470, 2715, 3472); private final long spinTimeOut = 3000; private long startTime; private long lastSpin = 0; private long runTime = System.currentTimeMillis() - startTime; private int counter = 0; public boolean NeedsToBank() { return getAPIContext().inventory().isFull() && getAPIContext().inventory().contains("Bow string") && !seersBank.contains(local); } public void walksToBank() { getAPIContext().webWalking().walkToBank(); } public boolean needsToOpenBank() { return !getAPIContext().bank().isOpen(); } public void openBank() { getAPIContext().bank().open(); } public boolean doesNeedToDeposit() { return getAPIContext().bank().isOpen() && !getAPIContext().inventory().isEmpty(); } public void depositAll() { counter = counter + 28; getAPIContext().bank().depositInventory(); } public boolean needsToWalkToFlax() { local = getAPIContext().localPlayer().get(); return !getAPIContext().inventory().isFull() && !flaxField.contains(local); } public void walkFlaxField() { getAPIContext().webWalking().walkTo(flaxField.getRandomTile()); } public boolean shouldPick() { local = getAPIContext().localPlayer().get(); return flaxField.contains(local) && !getAPIContext().inventory().isFull(); } public boolean needsToWalkToSpin() { local = getAPIContext().localPlayer().get(); return getAPIContext().inventory().isFull() && getAPIContext().inventory().contains("Flax") && local.getPlane() != 1; } public void walksToSpin() { SceneObject ladder = getAPIContext().objects().query().nameMatches("Ladder").results().nearest(); if (!stairRoom.contains(local)) { getAPIContext().webWalking().walkTo(ladderTile); } else { getAPIContext().objects().query().nameMatches("Ladder").results().nearest().interact("Climb-up"); } } public boolean shouldSpin() { local = getAPIContext().localPlayer().get(); return local.getPlane() == 1 && getAPIContext().inventory().contains("Flax"); } public final String formatTime(long ms) { long s = ms / 1000, m = s / 60, h = m / 60, d = h / 24; s %= 60; m %= 60; h %= 24; return d > 0 ? String.format("%02d:%02d:%02d:%02d", d, h, m, s) : h > 0 ? String.format("%02d:%02d:%02d", h, m, s) : String.format("%02d:%02d", m, s); } //========================================================================================================================== private SceneObject getFlax() { return getAPIContext().objects().query().nameMatches("Flax").actions("Pick").results().nearest(); } private void pick() { flax = getFlax(); if (flax != null) { flax.interact("Pick"); } } private SceneObject getSpinning() { return getAPIContext().objects().query().nameMatches("Spinning wheel").results().nearest(); } private void spin() { if (getAPIContext().localPlayer().getAnimation() == 894) { lastSpin = System.currentTimeMillis(); } if (notSpinning()) { System.out.println("memes plz work"); WidgetGroup spinInterface = getAPIContext().widgets().get(270); spinningWheel = getSpinning(); if (spinInterface != null && spinInterface.isVisible()) { System.out.println("pressing 3"); getAPIContext().keyboard().sendKey(51); lastSpin = System.currentTimeMillis(); } else if (spinningWheel != null) { System.out.println("tryna spin"); if (spinningWheel.interact("Spin")) { Time.sleep(9000, () -> getAPIContext().widgets().get(270).isVisible()); } } } } private boolean notSpinning() { return System.currentTimeMillis() - lastSpin > spinTimeOut; } @Override public boolean onStart(String... strings) { System.out.println("FlaxPickSpinOP"); startTime = System.currentTimeMillis(); return true; } //============================================================================================================ private BufferedImage bg = downloadImage("https://i.imgur.com/uesM6ze.png"); @Override protected void onPaint(Graphics2D g, APIContext a) { long runTime = System.currentTimeMillis() - startTime; g.drawImage(bg, 0, getAPIContext().game().getViewportHeight() - 165, null); PaintFrame frame = new PaintFrame("It Just 'Works'"); frame.addLine("Kush Manicured", counter); frame.addLine(formatTime(runTime), ""); frame.draw(g, 293, getAPIContext().game().getViewportHeight() - 63, getAPIContext()); } // function to parse the image public BufferedImage downloadImage(String url) { try { HttpURLConnection conn; conn = (HttpURLConnection)(new URL(url.replaceAll(" ", "%20")).openConnection()); conn.setInstanceFollowRedirects(false); conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8"); conn.setRequestProperty("Accept", "ttext/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8"); conn.setRequestProperty("Accept-Language", "en-us,en;q=0.5"); conn.setRequestProperty("Accept-Encoding", "gzip, deflate"); conn.setRequestProperty("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7"); conn.setRequestProperty("Keep-Alive", "300"); conn.setRequestProperty("Connection", "keep-alive"); conn.setRequestMethod("GET"); return ImageIO.read(conn.getInputStream()); } catch(IOException e1) { return null; } } @Override protected int loop() { if (!getAPIContext().client().isLoggedIn()) { System.out.println("hold up till you are logged in mayne"); return 300; } if (needsToWalkToFlax()) { System.out.println("Walking to the fields"); walkFlaxField(); } else if (shouldPick()) { System.out.println("Picking up the DANK KUSH"); pick(); } else if (needsToWalkToSpin()) { System.out.println("On my way to spin my KUSH"); walksToSpin(); } else if (shouldSpin()) { System.out.println("Processing the KUSH"); System.out.println("Smells nice"); spin(); } else if (NeedsToBank()) { System.out.println("Walkin to the Dank Bank"); System.out.println("Sneaky Beaky Style"); walksToBank(); } else if (needsToOpenBank()) { System.out.println("Opening Dank Bank"); openBank(); } else if (doesNeedToDeposit()) { System.out.println("Depositing Dank"); depositAll(); } else { getAPIContext().script().stop("get danker"); } return 2000; } } Edited January 15, 2021 by ItsYaBoiEd added footage and updated the paint for script 2 Quote Link to comment Share on other sites More sharing options...
Sellout Posted January 15, 2021 Share Posted January 15, 2021 good shit 1 Quote Link to comment Share on other sites More sharing options...
blackdemon0734 Posted January 15, 2021 Share Posted January 15, 2021 nice 1 Quote Link to comment Share on other sites More sharing options...
Global Moderators MansNoThot Posted January 15, 2021 Global Moderators Share Posted January 15, 2021 Noice 1 Quote Link to comment Share on other sites More sharing options...
Proto Posted January 15, 2021 Share Posted January 15, 2021 From a runescape botting video connoisseur, to a low life scripter like us 😄 Welcome ❤️ 1 Quote Link to comment Share on other sites More sharing options...
Mint Posted January 21, 2021 Share Posted January 21, 2021 Wow nice, this your first script? Great job... might be on to something here, perhaps create a few more 🙂 1 Quote Link to comment Share on other sites More sharing options...
ItsYaBoiEd Posted January 21, 2021 Author Share Posted January 21, 2021 2 hours ago, Mint said: Wow nice, this your first script? Great job... might be on to something here, perhaps create a few more 🙂 Im on it man! Created 2 more after this one 😄 Quote Link to comment Share on other sites More sharing options...
Satanicvegan Posted July 22, 2021 Share Posted July 22, 2021 How do I run this script? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.