Shaft Posted May 24, 2017 Share Posted May 24, 2017 (edited) PotatoPicker What does it do: -Picks potatoes in draynor -Banks Screen shot: Source: Spoiler Main: import java.awt.Color; import java.awt.Graphics2D; import java.awt.Image; import java.io.IOException; import java.net.URL; import javax.imageio.ImageIO; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.api.ui.Message; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; import PotatoMeister.Calculations; @ScriptManifest(author = "PotatoSalad", info = "Picks potatoes at draynor", logo = "", name = "PotatoPicker", version = 1.0) public class PotatoPicker extends Script{ private Image chat = getImage("http://i.imgur.com/gDz0NuG.png"); private final Area bank = new Area(3092, 3242, 3094, 3245); private final Area field = new Area(3139, 3289, 3150, 3279); private RS2Object potato, booth; private int price; private int count, count2, collected; private long startTime; public void onStart(){ price = Calculations.getPrice(1942); startTime = System.currentTimeMillis(); } public void onMessage(Message m){ if(m.getMessage().contains("You pick a potato.")){ count++; collected++; } } public int onLoop() throws InterruptedException { if(getInventory().isFull()){ bank(); }else{ if(field.contains(myPlayer())){ if(!myPlayer().isAnimating() && !myPlayer().isMoving()){ potato = getObjects().closest(g -> g != null && g.getName().equalsIgnoreCase("Potato") && g.hasAction("Pick") && field.contains(g)); potato.interact("Pick"); count = 0; int r = Calculations.Random(1200, 1600); while(count == 0 && count2 < r){ sleep(1); count2++; } count2 = 0; } }else{ getWalking().webWalk(field); } } return Calculations.Random(452, 569); } public void onPaint(Graphics2D g) { g.drawImage(chat, 1, 254, null); long Runtime = System.currentTimeMillis() - startTime; long runtime = (int)(Runtime / 1000); long collectph = 3600 / runtime * collected; long profitph = collectph * price; long profit = collected * price; g.setColor(new Color(31, 221, 223)); g.drawString("" + collected, 30, 390); g.drawString("" + collectph, 30, 433); g.drawString("" + profit, 330, 390); g.drawString("" + profitph, 330, 433); g.setColor(Color.WHITE); } private void bank() { if(bank.contains(myPlayer())){ if(getBank().isOpen()){ getBank().depositAll(); getBank().close(); }else{ booth = getObjects().closest(g -> g != null && g.getName().equalsIgnoreCase("Bank booth") && g.hasAction("Bank")); booth.interact("Bank"); new ConditionalSleep(4500, Calculations.Random(100, 200)) { public boolean condition() throws InterruptedException { return getBank().isOpen(); } }.sleep(); } }else{ getWalking().webWalk(bank); } } private Image getImage(String url) { try { return ImageIO.read(new URL(url)); } catch (IOException e) { return null; } } } Calculations: import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import java.util.Random; public class Calculations { private final static String BASE_URL = "http://services.runescape.com/m=itemdb_oldschool/api/catalogue/detail.json?item="; private final static int MILLION = 1000000; private final static int THOUSAND = 1000; public static int Random(int min, int max){ Random r = new Random(); return r.nextInt((max - min) + 1) +min; } public static int getPrice(final int id) { try (final BufferedReader reader = new BufferedReader(new InputStreamReader(new URL(BASE_URL + id).openStream()))) { final String raw = reader.readLine().replace(",", "").replace("\"", "").split("price:")[1].split("}")[0]; return raw.endsWith("m") || raw.endsWith("k") ? (int) (Double.parseDouble(raw.substring(0, raw.length() - 1)) * (raw.endsWith("m") ? MILLION : THOUSAND)) : Integer.parseInt(raw); } catch (final Exception e) { e.printStackTrace(); } return -1; } } Download: https://mega.nz/#!E5hGUTgR!zuMbibdUnECd7bncfE-6tWpsrlqxn7E6awJ0KVKbuDE Edited May 24, 2017 by Shaft Quote Link to comment Share on other sites More sharing options...
gearing Posted May 24, 2017 Share Posted May 24, 2017 15 minutes ago, Shaft said: PotatoPicker Reveal hidden contents Main: import java.awt.Color; import java.awt.Graphics2D; import java.awt.Image; import java.io.IOException; import java.net.URL; import javax.imageio.ImageIO; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.api.ui.Message; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; import PotatoMeister.Calculations; @ScriptManifest(author = "PotatoSalad", info = "Picks potatoes at draynor", logo = "", name = "PotatoPicker", version = 1.0) public class PotatoPicker extends Script{ private Image chat = getImage("http://i.imgur.com/gDz0NuG.png"); private final Area bank = new Area(3092, 3242, 3094, 3245); private final Area field = new Area(3139, 3289, 3150, 3279); private RS2Object potato, booth; private int price; private int count, count2, collected; private long startTime; public void onStart(){ price = Calculations.getPrice(1942); startTime = System.currentTimeMillis(); } public void onMessage(Message m){ if(m.getMessage().contains("You pick a potato.")){ count++; collected++; } } public int onLoop() throws InterruptedException { if(getInventory().isFull()){ bank(); }else{ if(field.contains(myPlayer())){ if(!myPlayer().isAnimating() && !myPlayer().isMoving()){ potato = getObjects().closest(g -> g != null && g.getName().equalsIgnoreCase("Potato") && g.hasAction("Pick") && field.contains(g)); potato.interact("Pick"); count = 0; int r = Calculations.Random(1200, 1600); while(count == 0 && count2 < r){ sleep(1); count2++; } count2 = 0; } }else{ walk(field); } } return Calculations.Random(452, 569); } public void onPaint(Graphics2D g) { g.drawImage(chat, 1, 254, null); long Runtime = System.currentTimeMillis() - startTime; long runtime = (int)(Runtime / 1000); long collectph = 3600 / runtime * collected; long profitph = collectph * price; long profit = collected * price; g.setColor(new Color(31, 221, 223)); //g.setFont(new Font("Arial", 1, 11)); g.drawString("" + collected, 30, 390); g.drawString("" + collectph, 30, 433); g.drawString("" + profit, 330, 390); g.drawString("" + profitph, 330, 433); g.setColor(Color.WHITE); } private void bank() { if(bank.contains(myPlayer())){ if(getBank().isOpen()){ getBank().depositAll(); getBank().close(); }else{ booth = getObjects().closest(g -> g != null && g.getName().equalsIgnoreCase("Bank booth") && g.hasAction("Bank")); booth.interact("Bank"); new ConditionalSleep(4500, Calculations.Random(100, 200)) { public boolean condition() throws InterruptedException { return getBank().isOpen(); } }.sleep(); } }else{ walk(bank); } } private void walk(Area a){ if(!getSettings().isRunning() && getSettings().getRunEnergy() >= Calculations.Random(34, 42) + Calculations.Random(-5, 4)) { getSettings().setRunning(true); } getWalking().webWalk(a); } private Image getImage(String url) { try { return ImageIO.read(new URL(url)); } catch (IOException e) { return null; } } } Calculations: import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import java.util.Random; public class Calculations { private final static String BASE_URL = "http://services.runescape.com/m=itemdb_oldschool/api/catalogue/detail.json?item="; private final static int MILLION = 1000000; private final static int THOUSAND = 1000; public static int Random(int min, int max){ Random r = new Random(); return r.nextInt((max - min) + 1) +min; } public static int getPrice(final int id) { try (final BufferedReader reader = new BufferedReader(new InputStreamReader(new URL(BASE_URL + id).openStream()))) { final String raw = reader.readLine().replace(",", "").replace("\"", "").split("price:")[1].split("}")[0]; return raw.endsWith("m") || raw.endsWith("k") ? (int) (Double.parseDouble(raw.substring(0, raw.length() - 1)) * (raw.endsWith("m") ? MILLION : THOUSAND)) : Integer.parseInt(raw); } catch (final Exception e) { e.printStackTrace(); } return -1; } } https://mega.nz/#!FtwXkbia!TUMikzODQObFfk1RiGMTGlXKHpKqZuoOYS-Yey8I0hg the literal Irish script congrats on the release!:D:D:D Quote Link to comment Share on other sites More sharing options...
Savage63 Posted May 24, 2017 Share Posted May 24, 2017 nice release will try to this for the lulz Quote Link to comment Share on other sites More sharing options...
Void Posted May 24, 2017 Share Posted May 24, 2017 Nice release Does this have deathwalking/barrows boss support? Quote Link to comment Share on other sites More sharing options...
Shaft Posted May 24, 2017 Author Share Posted May 24, 2017 Thanks, of course it has barrows boss support... Quote Link to comment Share on other sites More sharing options...
gosubear Posted May 24, 2017 Share Posted May 24, 2017 3 hours ago, Shaft said: PotatoPicker What does it do: -Picks potatoes in draynor -Banks Screen shot: Source: Reveal hidden contents Main: import java.awt.Color; import java.awt.Graphics2D; import java.awt.Image; import java.io.IOException; import java.net.URL; import javax.imageio.ImageIO; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.api.ui.Message; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; import PotatoMeister.Calculations; @ScriptManifest(author = "PotatoSalad", info = "Picks potatoes at draynor", logo = "", name = "PotatoPicker", version = 1.0) public class PotatoPicker extends Script{ private Image chat = getImage("http://i.imgur.com/gDz0NuG.png"); private final Area bank = new Area(3092, 3242, 3094, 3245); private final Area field = new Area(3139, 3289, 3150, 3279); private RS2Object potato, booth; private int price; private int count, count2, collected; private long startTime; public void onStart(){ price = Calculations.getPrice(1942); startTime = System.currentTimeMillis(); } public void onMessage(Message m){ if(m.getMessage().contains("You pick a potato.")){ count++; collected++; } } public int onLoop() throws InterruptedException { if(getInventory().isFull()){ bank(); }else{ if(field.contains(myPlayer())){ if(!myPlayer().isAnimating() && !myPlayer().isMoving()){ potato = getObjects().closest(g -> g != null && g.getName().equalsIgnoreCase("Potato") && g.hasAction("Pick") && field.contains(g)); potato.interact("Pick"); count = 0; int r = Calculations.Random(1200, 1600); while(count == 0 && count2 < r){ sleep(1); count2++; } count2 = 0; } }else{ getWalking().webWalk(field); } } return Calculations.Random(452, 569); } public void onPaint(Graphics2D g) { g.drawImage(chat, 1, 254, null); long Runtime = System.currentTimeMillis() - startTime; long runtime = (int)(Runtime / 1000); long collectph = 3600 / runtime * collected; long profitph = collectph * price; long profit = collected * price; g.setColor(new Color(31, 221, 223)); g.drawString("" + collected, 30, 390); g.drawString("" + collectph, 30, 433); g.drawString("" + profit, 330, 390); g.drawString("" + profitph, 330, 433); g.setColor(Color.WHITE); } private void bank() { if(bank.contains(myPlayer())){ if(getBank().isOpen()){ getBank().depositAll(); getBank().close(); }else{ booth = getObjects().closest(g -> g != null && g.getName().equalsIgnoreCase("Bank booth") && g.hasAction("Bank")); booth.interact("Bank"); new ConditionalSleep(4500, Calculations.Random(100, 200)) { public boolean condition() throws InterruptedException { return getBank().isOpen(); } }.sleep(); } }else{ getWalking().webWalk(bank); } } private Image getImage(String url) { try { return ImageIO.read(new URL(url)); } catch (IOException e) { return null; } } } Calculations: import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import java.util.Random; public class Calculations { private final static String BASE_URL = "http://services.runescape.com/m=itemdb_oldschool/api/catalogue/detail.json?item="; private final static int MILLION = 1000000; private final static int THOUSAND = 1000; public static int Random(int min, int max){ Random r = new Random(); return r.nextInt((max - min) + 1) +min; } public static int getPrice(final int id) { try (final BufferedReader reader = new BufferedReader(new InputStreamReader(new URL(BASE_URL + id).openStream()))) { final String raw = reader.readLine().replace(",", "").replace("\"", "").split("price:")[1].split("}")[0]; return raw.endsWith("m") || raw.endsWith("k") ? (int) (Double.parseDouble(raw.substring(0, raw.length() - 1)) * (raw.endsWith("m") ? MILLION : THOUSAND)) : Integer.parseInt(raw); } catch (final Exception e) { e.printStackTrace(); } return -1; } } Download: https://mega.nz/#!E5hGUTgR!zuMbibdUnECd7bncfE-6tWpsrlqxn7E6awJ0KVKbuDE Bug report: Potatoes collected count on Screenie ^ is wrong. Quote Link to comment Share on other sites More sharing options...
Martyr Posted May 24, 2017 Share Posted May 24, 2017 Funny! Gratz on the release bud. Quote Link to comment Share on other sites More sharing options...
Shaft Posted May 24, 2017 Author Share Posted May 24, 2017 (edited) 1 hour ago, gosubear said: Bug report: Potatoes collected count on Screenie ^ is wrong. I had 1 in my inv before 16 minutes ago, Martyr said: Funny! Gratz on the release bud. Thanks Edited May 24, 2017 by Shaft Quote Link to comment Share on other sites More sharing options...
daamurda Posted May 24, 2017 Share Posted May 24, 2017 whenever i make a new accounts i do this for a little before looting for easy money. Nice release Quote Link to comment Share on other sites More sharing options...
okaymate Posted May 25, 2017 Share Posted May 25, 2017 well done. good for starting :b Quote Link to comment Share on other sites More sharing options...
cammofunk Posted June 20, 2017 Share Posted June 20, 2017 Learning a lot from you, thanks for the script! 1 Quote Link to comment Share on other sites More sharing options...