Salty as fuck Posted January 27, 2016 Share Posted January 27, 2016 (edited) >>DOWNLOAD<< Requirements: 67 cooking Start in catherby if cooking items. Item requirements: bowl potato/baked potato tuna/raw tuna cooked sweetcorn/sweetcorn pat of butter Checklist - Cook sweetcorn Cook tuna Cook potato Butter on potato Cut tuna Corn on chopped tuna Tuna & corn on baked potato Pattern mode - Rather than manually changing tasks, finish one by one automatically Post bugs if you encounter any. I'll gladly take donations if anyone is interested remicidal@gmail.com Quick proggy of it cooking the tuna in pattern mode. another proggy submitted by animos another proggy by animos (he's made 47m so far and no ban) Edited February 1, 2016 by Reminiscence 1 Quote Link to comment Share on other sites More sharing options...
Realist Posted January 27, 2016 Share Posted January 27, 2016 (edited) Leachers right now : Edited January 27, 2016 by Realist 2 Quote Link to comment Share on other sites More sharing options...
Salty as fuck Posted January 27, 2016 Author Share Posted January 27, 2016 they can enjoy their profit for the next few weeks lol Quote Link to comment Share on other sites More sharing options...
Animos Posted January 27, 2016 Share Posted January 27, 2016 Rip prices Quote Link to comment Share on other sites More sharing options...
Salty as fuck Posted January 27, 2016 Author Share Posted January 27, 2016 make your mils while you can Quote Link to comment Share on other sites More sharing options...
Acerd Posted January 27, 2016 Share Posted January 27, 2016 Code looks clean. Quote Link to comment Share on other sites More sharing options...
Salty as fuck Posted January 27, 2016 Author Share Posted January 27, 2016 (edited) Code looks clean. It was a first go at enums. Code definitely could've been cleaner as well. import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.api.ui.RS2Widget; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.script.*; import javax.imageio.ImageIO; import javax.swing.*; import javax.swing.border.EmptyBorder; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import java.net.URL; import java.text.NumberFormat; @ScriptManifest(author = "Reminiscence", name = "Tuna Potatoes", info = "Start at catherby if cooking.", version = 1.0, logo = "") public class CatherbyCooker extends Script { int startEXP; long startTime, runTime; RS2Widget w; RS2Widget lvlup; RS2Widget cont; RS2Object range; RS2Object banks; String state = "Initializing"; boolean patternMode = false; GUI g = new GUI(); int rawSweetcorn = 5986, cookedSweecorn= 5988, rawTuna = 359, rawPotato = 1942, butter = 6697, bakedPotato = 6701, cookedTuna = 361, bowl = 1923, knife = 946, choppedTuna = 7086, butteredPotato = 6703, tunaandcorn = 7068, stage = 0; boolean guiWait = false, potato = false, sweetcorn = false, tuna = false, butteronpotato = false, sweetcornontuna = false, cuttuna = false, potatoandtuna = false; int amt = (random(28, 350)); enum State { cook, bank, idle, butterOnPotato, cutTuna, sweetcornOnTuna, potatoWithTuna, exit }; @Override public void onStart() { log("Version 0.2"); startEXP = getSkills().getExperience(Skill.COOKING); g.setVisible(true); while(guiWait) try { sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } } private State getState() throws InterruptedException { if (guiWait == false) { if (sweetcorn == true) { if (!inventory.contains(rawSweetcorn) && !amIAnimating() && !players.myPlayer().isMoving()) { state = "banking"; return State.bank; } if (inventory.contains(rawSweetcorn) && !amIAnimating()) { state = "cooking"; return State.cook; } if (amIAnimating() == true || players.myPlayer().isAnimating()) { return State.idle; } if (!bank.contains("Sweetcorn")) { return State.exit; } } if (potato == true) { if (!inventory.contains(rawPotato) && !amIAnimating() && !players.myPlayer().isMoving()) { state = "banking"; return State.bank; } if (inventory.contains(rawPotato) && !amIAnimating()) { state = "cooking"; return State.cook; } if (amIAnimating() == true || players.myPlayer().isAnimating()) { return State.idle; } if (!bank.contains("Potato")) { return State.exit; } } if (tuna == true) { if (!inventory.contains(rawTuna) && !amIAnimating() && !players.myPlayer().isMoving()) { state = "banking"; return State.bank; } if (inventory.contains(rawTuna) && !amIAnimating()) { state = "cooking"; return State.cook; } if (amIAnimating() == true || players.myPlayer().isAnimating()) { return State.idle; } if (!bank.contains("Raw tuna")) { return State.exit; } } if (butteronpotato == true) { if (!inventory.contains(bakedPotato) || !inventory.contains(butter)) { return State.bank; } if (inventory.contains(bakedPotato) && inventory.contains(butter)) { return State.butterOnPotato; } if (!bank.contains(bakedPotato) || !bank.contains(butter)) { return State.exit; } } if (cuttuna == true) { if (!inventory.contains(cookedTuna) || !inventory.contains(bowl)) { return State.bank; } if (inventory.contains(cookedTuna) && inventory.contains(bowl)) { return State.cutTuna; } if (!bank.contains("Tuna") || !bank.contains("Bowl")) { return State.exit; } } if (potatoandtuna == true) { if (!inventory.contains(butteredPotato) || !inventory.contains(tunaandcorn)) { return State.bank; } if (inventory.contains(butteredPotato) && inventory.contains(tunaandcorn)) { state = "potato with tuna"; return State.potatoWithTuna; } if (!bank.contains("Potato with butter") || !bank.contains("Tuna and corn")) { return State.exit; } } if (sweetcornontuna == true) { if (!inventory.contains("Cooked sweetcorn") || !inventory.contains("Chopped tuna")) { return State.bank; } if (inventory.contains("Cooked sweetcorn") && inventory.contains("Chopped tuna")) { return State.sweetcornOnTuna; } if (!bank.contains("Cooked sweetcorn") || !bank.contains("Chopped tuna")) { return State.exit; } } } return State.idle; } @Override public int onLoop() throws InterruptedException { lvlup = widgets.get(233, 11); //lvl up screen cont = widgets.get(233, 2); //continue if (lvlup != null) { cont.interact("Continue"); } w = widgets.get(307, 2); range = objects.closest("Range"); banks = objects.closest("Bank booth"); switch (getState()) { case exit: stop(); break; case bank: if (!amIAnimating() || !players.myPlayer().isMoving() && !bank.isOpen()) { bank.open(); if (sweetcorn == true) { if (!inventory.contains(rawSweetcorn)) { state = "banking"; if (!inventory.isEmpty()) { bank.depositAll(); } if (bank.contains(rawSweetcorn)) { bank.withdraw(rawSweetcorn, amt); bank.close(); } else if (bank.isOpen() && !bank.contains(rawSweetcorn) && patternMode == false) { log("out of sweetcorn"); stop(); } else if (bank.isOpen() && !bank.contains(rawSweetcorn) && patternMode == true) { log("switching to potatoes"); sweetcorn = false; potato = true; } } } if (potato == true) { if (!inventory.contains(rawPotato)) { state = "banking"; if (!inventory.isEmpty()) { bank.depositAll(); } if (bank.contains(rawPotato) && !inventory.isFull()) { bank.withdraw(rawPotato, amt); if (inventory.contains(rawPotato)) { bank.close(); } } if (bank.isOpen() && !bank.contains(rawPotato) && patternMode == false) { log("out of potatoes"); stop(); } if (bank.isOpen() && !bank.contains(rawPotato) && patternMode == true) { log("switching to tuna"); potato = false; tuna = true; } } } if (tuna == true) { if (!inventory.contains(rawTuna)) { state = "banking"; if (!inventory.isEmpty()) { bank.depositAll(); } if (bank.contains(rawTuna)) { bank.withdraw(rawTuna, amt); if (inventory.contains(rawTuna)) { bank.close(); } } if (bank.isOpen() && !bank.contains(rawTuna) && patternMode == false) { log("out of tuna"); stop(); } if (bank.isOpen() && !bank.contains(rawTuna) && patternMode == true) { log("switching to buttering potatoes"); tuna = false; butteronpotato = true; } } } if (butteronpotato == true) { if (!inventory.contains(butter) || !inventory.contains(bakedPotato)) { state = "banking"; if (!inventory.isEmpty()) { bank.depositAll(); } if (bank.contains(bakedPotato) && bank.contains(butter)) { bank.withdraw(bakedPotato, 14); sleep(600); bank.withdraw(butter, 14); if (inventory.contains(bakedPotato, 14) && inventory.contains(butter, 14)) { bank.close(); } } if (bank.isOpen() && patternMode == false && (!bank.contains(bakedPotato) || !bank.contains(butter))) { log("out of butter and baked potatoes"); stop(); } if (bank.isOpen() && patternMode == true && (!bank.contains(bakedPotato) || !bank.contains(butter))) { log("switching to cutting tuna"); butteronpotato = false; cuttuna = true; } } } if (cuttuna == true) { if (!inventory.contains("Tuna") || !inventory.contains("Bowl")) { state = "banking"; if (!inventory.isEmpty()) { bank.depositAllExcept("Knife"); } if (!inventory.contains("Knife")) { bank.withdraw("Knife", 1); } if (bank.contains("Tuna") && bank.contains("Bowl")) { bank.withdraw("Tuna", 13); sleep(600); bank.withdraw("Bowl", 13); if (inventory.contains("Bowl") && inventory.contains("Tuna")) { bank.close(); } } if (patternMode == false && bank.isOpen() && (!bank.contains("Tuna") || !bank.contains("Bowl"))) { log("out of cooked tuna and bowls"); stop(); } if ( patternMode == true && bank.isOpen() && (!bank.contains("Tuna") || !inventory.contains("Bowl"))) { log("switching to sweetcorn and tuna"); cuttuna = false; sweetcornontuna = true; } } } if (sweetcornontuna == true) { if (!inventory.contains("Cooked sweetcorn") || !inventory.contains("Chopped tuna")) { state = "banking"; if (!inventory.isEmpty()) { bank.depositAll(); } if (bank.isOpen() && bank.contains("Cooked sweetcorn") && bank.contains("Chopped tuna")) { bank.withdraw("Cooked sweetcorn", 14); sleep(600); bank.withdraw("Chopped tuna", 14); if (inventory.contains("Chopped tuna") && inventory.contains("Cooked sweetcorn")) { bank.close(); } } if (bank.isOpen() && (!bank.contains("Cooked sweetcorn") || !bank.contains("Chopped tuna")) && patternMode == false) { stop(); } if (bank.isOpen() && patternMode == true && (!bank.contains("Cooked sweetcorn") || !bank.contains("Chopped tuna"))) { log("switching to potatoes and tuna"); sweetcornontuna = false; potatoandtuna = true; } } } if (potatoandtuna == true) { if (!inventory.contains(butteredPotato) || !inventory.contains(tunaandcorn)) { state = "banking"; if (!inventory.isEmpty()) { bank.depositAll(); } if (bank.isOpen() && (!bank.contains(butteredPotato) || !bank.contains(tunaandcorn))) { log("shutting down"); stop(); } if (bank.isOpen() && bank.contains(butteredPotato) && bank.contains(tunaandcorn)) { bank.withdraw("Potato with butter", 14); sleep(600); bank.withdraw(tunaandcorn, 14); if (inventory.contains(butteredPotato, 14) && inventory.contains(tunaandcorn, 14)) { bank.close(); } } } } } break; case butterOnPotato: RS2Widget w2 = widgets.get(309, 2); if (w2 == null && !bank.isOpen() && inventory.contains(bakedPotato) && inventory.contains(butter)) { interactItems2("Pat of butter", "Baked potato"); sleep(1650); } if (w2 != null) { w2.interact("Make All"); state = "butter on potato"; sleep (17000); } break; case idle: state = "idling"; sleep(600); break; case cook: if (!bank.isOpen()) { w = widgets.get(307, 2); if (sweetcorn == true && !amIAnimating() && w == null) { if (inventory.contains(rawSweetcorn) && !players.myPlayer().isMoving()) { inventory.getItem(rawSweetcorn).interact(); range.interact("Use"); } else { } } if (potato == true && !amIAnimating() && w == null) { if (inventory.contains(rawPotato) && !players.myPlayer().isMoving()) { inventory.getItem(rawPotato).interact("Use"); range.interact("Use"); } else { } } if (tuna == true && !amIAnimating() && w == null) { if (inventory.contains(rawTuna) && !players.myPlayer().isMoving()) { inventory.getItem(rawTuna).interact(); range.interact("Use"); } else { } } if (w != null) { state = "cooking"; w.interact("Cook All"); sleep (3500); } if (sweetcorn == true && amIAnimating()) { state = "sleeping"; sleep(800); } } break; case cutTuna: RS2Widget w3 = widgets.get(309, 2); if (w3 == null && !bank.isOpen() && inventory.contains("Tuna") && inventory.contains(bowl)) { interactItems("Knife", "Tuna"); sleep(1250); } if (w3 != null) { w3.interact("Make All"); state = "Cutting tuna"; sleep (17000); } break; case sweetcornOnTuna: RS2Widget w4 = widgets.get(309, 2); if (w4 == null && !bank.isOpen() && inventory.contains("Chopped tuna") && inventory.contains("Cooked sweetcorn")) { state = "combining corn and tuna"; interactItems2("Cooked sweetcorn", "Chopped tuna"); sleep(1250); } if (w4 != null) { w4.interact("Make All"); state = "Sweetcorn on tuna"; sleep (18000); } break; case potatoWithTuna: RS2Widget w5 = widgets.get(309, 2); if (!bank.isOpen() && w5 == null && inventory.contains("Tuna and corn") && inventory.contains("Potato with butter")) { state = "finishing up"; interactItems2("Tuna and corn", "Potato with butter"); sleep(1250); } if (w5 != null) { w5.interact("Make All"); state = "Tuna Potatoes"; sleep (20000); } break; } return 0; } public boolean interactItems(String item1, String item2) throws InterruptedException { if (!bank.isOpen()) { if (!players.myPlayer().isAnimating() && inventory.getItem(item1).interact()) { return inventory.getItem(item2).interact(); // } } return false; } public boolean interactItems2(String item1, String item2) throws InterruptedException { if (!bank.isOpen()) { if (inventory.getItem(item1).interact("Use")) { return inventory.getItem(item2).interact(); // } } return false; } public boolean amIAnimating() throws InterruptedException{ for(int i = 0; i < 5; i++){ if(myPlayer().isAnimating() || players.myPlayer().isMoving()) return true; else sleep(100); } return false; } public String format(long time) { StringBuilder string = new StringBuilder(); long totalSeconds = time / 1000L; long totalMinutes = totalSeconds / 60L; long totalHours = totalMinutes / 60L; int seconds = (int)totalSeconds % 60; int minutes = (int)totalMinutes % 60; int hours = (int)totalHours % 24; if (hours > 0) { string.append(hours + "h "); } if (minutes > 0) { string.append(minutes + "m "); } string.append(seconds +"s"); return string.toString(); } public int getHourlyRate(int variable) { return (int)((variable - 0) * 3600000.0D / (System.currentTimeMillis() - this.startTime)); } private final RenderingHints antialiasing = new RenderingHints( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); private Image getImage(String url) { try { return ImageIO.read(new URL(url)); } catch(IOException e) { return null; } } private final Color color1 = new Color(0, 0, 0, 200); private final Color color2 = new Color(255, 0, 0); private final BasicStroke stroke1 = new BasicStroke(1); private final Font font1 = new Font("Arial", 0, 12); private final Image img1 = getImage("http://i.imgur.com/tyqNd5y.png"); @Override public void onPaint(Graphics2D g) { long xpGain = getSkills().getExperience(Skill.COOKING) - startEXP; g.setRenderingHints(antialiasing); g.setColor(color1); g.fillRect(548, 396, 191, 69); g.setColor(color2); g.setStroke(stroke1); g.drawRect(548, 396, 191, 69); g.setColor(color1); g.fillRect(599, 378, 96, 16); g.setColor(color2); g.drawRect(599, 378, 96, 16); g.setFont(font1); g.drawString("Tuna Potatoes", 605, 390); g.drawImage(img1, 659, 345, null); g.drawString("Runtime: " + format((System.currentTimeMillis()-startTime)), 555, 410); g.drawString("EXP Gained: " +xpGain, 555, 425); g.drawString("EXP/Hour: " + NumberFormat.getIntegerInstance().format(xpGain *3600000D / (System.currentTimeMillis() - startTime)), 555, 440); g.drawString("State: " + state, 555, 455); } public class GUI extends JFrame { private static final long serialVersionUID = 1L; private JPanel contentPane; @SuppressWarnings({ "rawtypes", "unchecked" }) public GUI() { setTitle("Tuna Potatoes"); setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); setBounds(100, 100, 240, 101); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); final JComboBox comboBox = new JComboBox(); comboBox.setModel(new DefaultComboBoxModel(new String[] {"Sweetcorn", "Tuna", "Potato", "Butter on potato", "Cut tuna", "Sweetcorn on tuna", "Potato on tuna", "Pattern mode"})); comboBox.setBounds(10, 11, 212, 20); contentPane.add(comboBox); JButton btnStart = new JButton("Start"); btnStart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { startTime = System.currentTimeMillis(); if (comboBox.getSelectedItem().equals("Sweetcorn")) { sweetcorn = true; } if (comboBox.getSelectedItem().equals("Potato")) { potato = true; } if (comboBox.getSelectedItem().equals("Tuna")) { tuna = true; } if (comboBox.getSelectedItem().equals("Butter on potato")) { butteronpotato = true; } if (comboBox.getSelectedItem().equals("Cut tuna")) { cuttuna = true; } if (comboBox.getSelectedItem().equals("Sweetcorn on tuna")) { sweetcornontuna = true; } if (comboBox.getSelectedItem().equals("Potato on tuna")) { potatoandtuna = true; } if (comboBox.getSelectedItem().equals("Pattern mode")) { log("Pattern mode started"); patternMode = true; sweetcorn = true; } guiWait = false; g.setVisible(false); } }); btnStart.setBounds(71, 42, 89, 23); contentPane.add(btnStart); } } @Override public void onExit() throws InterruptedException { long xpGain = getSkills().getExperience(Skill.COOKING) - startEXP; log("Runtime: " + format((System.currentTimeMillis()-startTime))); log("EXP Gained: " + xpGain); log("EXP/HR: " + NumberFormat.getIntegerInstance().format(xpGain *3600000D / (System.currentTimeMillis() - startTime))); } } Edited January 27, 2016 by Reminiscence Quote Link to comment Share on other sites More sharing options...
Acerd Posted January 27, 2016 Share Posted January 27, 2016 (edited) It was a first go at enums. Code definitely could've been cleaner as well. import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.api.ui.RS2Widget; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.script.*; import javax.imageio.ImageIO; import javax.swing.*; import javax.swing.border.EmptyBorder; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import java.net.URL; import java.text.NumberFormat; @ScriptManifest(author = "Reminiscence", name = "Tuna Potatoes", info = "Start at catherby if cooking.", version = 1.0, logo = "") public class CatherbyCooker extends Script { int startEXP; long startTime, runTime; RS2Widget w; RS2Widget lvlup; RS2Widget cont; RS2Object range; RS2Object banks; String state = "Initializing"; boolean patternMode = false; GUI g = new GUI(); int rawSweetcorn = 5986, cookedSweecorn= 5988, rawTuna = 359, rawPotato = 1942, butter = 6697, bakedPotato = 6701, cookedTuna = 361, bowl = 1923, knife = 946, choppedTuna = 7086, butteredPotato = 6703, tunaandcorn = 7068, stage = 0; boolean guiWait = false, potato = false, sweetcorn = false, tuna = false, butteronpotato = false, sweetcornontuna = false, cuttuna = false, potatoandtuna = false; int amt = (random(28, 350)); enum State { cook, bank, idle, butterOnPotato, cutTuna, sweetcornOnTuna, potatoWithTuna, exit }; @Override public void onStart() { log("Version 0.2"); startEXP = getSkills().getExperience(Skill.COOKING); g.setVisible(true); while(guiWait) try { sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } } private State getState() throws InterruptedException { if (guiWait == false) { if (sweetcorn == true) { if (!inventory.contains(rawSweetcorn) && !amIAnimating() && !players.myPlayer().isMoving()) { state = "banking"; return State.bank; } if (inventory.contains(rawSweetcorn) && !amIAnimating()) { state = "cooking"; return State.cook; } if (amIAnimating() == true || players.myPlayer().isAnimating()) { return State.idle; } if (!bank.contains("Sweetcorn")) { return State.exit; } } if (potato == true) { if (!inventory.contains(rawPotato) && !amIAnimating() && !players.myPlayer().isMoving()) { state = "banking"; return State.bank; } if (inventory.contains(rawPotato) && !amIAnimating()) { state = "cooking"; return State.cook; } if (amIAnimating() == true || players.myPlayer().isAnimating()) { return State.idle; } if (!bank.contains("Potato")) { return State.exit; } } if (tuna == true) { if (!inventory.contains(rawTuna) && !amIAnimating() && !players.myPlayer().isMoving()) { state = "banking"; return State.bank; } if (inventory.contains(rawTuna) && !amIAnimating()) { state = "cooking"; return State.cook; } if (amIAnimating() == true || players.myPlayer().isAnimating()) { return State.idle; } if (!bank.contains("Raw tuna")) { return State.exit; } } if (butteronpotato == true) { if (!inventory.contains(bakedPotato) || !inventory.contains(butter)) { return State.bank; } if (inventory.contains(bakedPotato) && inventory.contains(butter)) { return State.butterOnPotato; } if (!bank.contains(bakedPotato) || !bank.contains(butter)) { return State.exit; } } if (cuttuna == true) { if (!inventory.contains(cookedTuna) || !inventory.contains(bowl)) { return State.bank; } if (inventory.contains(cookedTuna) && inventory.contains(bowl)) { return State.cutTuna; } if (!bank.contains("Tuna") || !bank.contains("Bowl")) { return State.exit; } } if (potatoandtuna == true) { if (!inventory.contains(butteredPotato) || !inventory.contains(tunaandcorn)) { return State.bank; } if (inventory.contains(butteredPotato) && inventory.contains(tunaandcorn)) { state = "potato with tuna"; return State.potatoWithTuna; } if (!bank.contains("Potato with butter") || !bank.contains("Tuna and corn")) { return State.exit; } } if (sweetcornontuna == true) { if (!inventory.contains("Cooked sweetcorn") || !inventory.contains("Chopped tuna")) { return State.bank; } if (inventory.contains("Cooked sweetcorn") && inventory.contains("Chopped tuna")) { return State.sweetcornOnTuna; } if (!bank.contains("Cooked sweetcorn") || !bank.contains("Chopped tuna")) { return State.exit; } } } return State.idle; } @Override public int onLoop() throws InterruptedException { lvlup = widgets.get(233, 11); //lvl up screen cont = widgets.get(233, 2); //continue if (lvlup != null) { cont.interact("Continue"); } w = widgets.get(307, 2); range = objects.closest("Range"); banks = objects.closest("Bank booth"); switch (getState()) { case exit: stop(); break; case bank: if (!amIAnimating() || !players.myPlayer().isMoving() && !bank.isOpen()) { bank.open(); if (sweetcorn == true) { if (!inventory.contains(rawSweetcorn)) { state = "banking"; if (!inventory.isEmpty()) { bank.depositAll(); } if (bank.contains(rawSweetcorn)) { bank.withdraw(rawSweetcorn, amt); bank.close(); } else if (bank.isOpen() && !bank.contains(rawSweetcorn) && patternMode == false) { log("out of sweetcorn"); stop(); } else if (bank.isOpen() && !bank.contains(rawSweetcorn) && patternMode == true) { log("switching to potatoes"); sweetcorn = false; potato = true; } } } if (potato == true) { if (!inventory.contains(rawPotato)) { state = "banking"; if (!inventory.isEmpty()) { bank.depositAll(); } if (bank.contains(rawPotato) && !inventory.isFull()) { bank.withdraw(rawPotato, amt); if (inventory.contains(rawPotato)) { bank.close(); } } if (bank.isOpen() && !bank.contains(rawPotato) && patternMode == false) { log("out of potatoes"); stop(); } if (bank.isOpen() && !bank.contains(rawPotato) && patternMode == true) { log("switching to tuna"); potato = false; tuna = true; } } } if (tuna == true) { if (!inventory.contains(rawTuna)) { state = "banking"; if (!inventory.isEmpty()) { bank.depositAll(); } if (bank.contains(rawTuna)) { bank.withdraw(rawTuna, amt); if (inventory.contains(rawTuna)) { bank.close(); } } if (bank.isOpen() && !bank.contains(rawTuna) && patternMode == false) { log("out of tuna"); stop(); } if (bank.isOpen() && !bank.contains(rawTuna) && patternMode == true) { log("switching to buttering potatoes"); tuna = false; butteronpotato = true; } } } if (butteronpotato == true) { if (!inventory.contains(butter) || !inventory.contains(bakedPotato)) { state = "banking"; if (!inventory.isEmpty()) { bank.depositAll(); } if (bank.contains(bakedPotato) && bank.contains(butter)) { bank.withdraw(bakedPotato, 14); sleep(600); bank.withdraw(butter, 14); if (inventory.contains(bakedPotato, 14) && inventory.contains(butter, 14)) { bank.close(); } } if (bank.isOpen() && patternMode == false && (!bank.contains(bakedPotato) || !bank.contains(butter))) { log("out of butter and baked potatoes"); stop(); } if (bank.isOpen() && patternMode == true && (!bank.contains(bakedPotato) || !bank.contains(butter))) { log("switching to cutting tuna"); butteronpotato = false; cuttuna = true; } } } if (cuttuna == true) { if (!inventory.contains("Tuna") || !inventory.contains("Bowl")) { state = "banking"; if (!inventory.isEmpty()) { bank.depositAllExcept("Knife"); } if (!inventory.contains("Knife")) { bank.withdraw("Knife", 1); } if (bank.contains("Tuna") && bank.contains("Bowl")) { bank.withdraw("Tuna", 13); sleep(600); bank.withdraw("Bowl", 13); if (inventory.contains("Bowl") && inventory.contains("Tuna")) { bank.close(); } } if (patternMode == false && bank.isOpen() && (!bank.contains("Tuna") || !bank.contains("Bowl"))) { log("out of cooked tuna and bowls"); stop(); } if ( patternMode == true && bank.isOpen() && (!bank.contains("Tuna") || !inventory.contains("Bowl"))) { log("switching to sweetcorn and tuna"); cuttuna = false; sweetcornontuna = true; } } } if (sweetcornontuna == true) { if (!inventory.contains("Cooked sweetcorn") || !inventory.contains("Chopped tuna")) { state = "banking"; if (!inventory.isEmpty()) { bank.depositAll(); } if (bank.isOpen() && bank.contains("Cooked sweetcorn") && bank.contains("Chopped tuna")) { bank.withdraw("Cooked sweetcorn", 14); sleep(600); bank.withdraw("Chopped tuna", 14); if (inventory.contains("Chopped tuna") && inventory.contains("Cooked sweetcorn")) { bank.close(); } } if (bank.isOpen() && (!bank.contains("Cooked sweetcorn") || !bank.contains("Chopped tuna")) && patternMode == false) { stop(); } if (bank.isOpen() && patternMode == true && (!bank.contains("Cooked sweetcorn") || !bank.contains("Chopped tuna"))) { log("switching to potatoes and tuna"); sweetcornontuna = false; potatoandtuna = true; } } } if (potatoandtuna == true) { if (!inventory.contains(butteredPotato) || !inventory.contains(tunaandcorn)) { state = "banking"; if (!inventory.isEmpty()) { bank.depositAll(); } if (bank.isOpen() && (!bank.contains(butteredPotato) || !bank.contains(tunaandcorn))) { log("shutting down"); stop(); } if (bank.isOpen() && bank.contains(butteredPotato) && bank.contains(tunaandcorn)) { bank.withdraw("Potato with butter", 14); sleep(600); bank.withdraw(tunaandcorn, 14); if (inventory.contains(butteredPotato, 14) && inventory.contains(tunaandcorn, 14)) { bank.close(); } } } } } break; case butterOnPotato: RS2Widget w2 = widgets.get(309, 2); if (w2 == null && !bank.isOpen() && inventory.contains(bakedPotato) && inventory.contains(butter)) { interactItems2("Pat of butter", "Baked potato"); sleep(1650); } if (w2 != null) { w2.interact("Make All"); state = "butter on potato"; sleep (17000); } break; case idle: state = "idling"; sleep(600); break; case cook: if (!bank.isOpen()) { w = widgets.get(307, 2); if (sweetcorn == true && !amIAnimating() && w == null) { if (inventory.contains(rawSweetcorn) && !players.myPlayer().isMoving()) { inventory.getItem(rawSweetcorn).interact(); range.interact("Use"); } else { } } if (potato == true && !amIAnimating() && w == null) { if (inventory.contains(rawPotato) && !players.myPlayer().isMoving()) { inventory.getItem(rawPotato).interact("Use"); range.interact("Use"); } else { } } if (tuna == true && !amIAnimating() && w == null) { if (inventory.contains(rawTuna) && !players.myPlayer().isMoving()) { inventory.getItem(rawTuna).interact(); range.interact("Use"); } else { } } if (w != null) { state = "cooking"; w.interact("Cook All"); sleep (3500); } if (sweetcorn == true && amIAnimating()) { state = "sleeping"; sleep(800); } } break; case cutTuna: RS2Widget w3 = widgets.get(309, 2); if (w3 == null && !bank.isOpen() && inventory.contains("Tuna") && inventory.contains(bowl)) { interactItems("Knife", "Tuna"); sleep(1250); } if (w3 != null) { w3.interact("Make All"); state = "Cutting tuna"; sleep (17000); } break; case sweetcornOnTuna: RS2Widget w4 = widgets.get(309, 2); if (w4 == null && !bank.isOpen() && inventory.contains("Chopped tuna") && inventory.contains("Cooked sweetcorn")) { state = "combining corn and tuna"; interactItems2("Cooked sweetcorn", "Chopped tuna"); sleep(1250); } if (w4 != null) { w4.interact("Make All"); state = "Sweetcorn on tuna"; sleep (18000); } break; case potatoWithTuna: RS2Widget w5 = widgets.get(309, 2); if (!bank.isOpen() && w5 == null && inventory.contains("Tuna and corn") && inventory.contains("Potato with butter")) { state = "finishing up"; interactItems2("Tuna and corn", "Potato with butter"); sleep(1250); } if (w5 != null) { w5.interact("Make All"); state = "Tuna Potatoes"; sleep (20000); } break; } return 0; } public boolean interactItems(String item1, String item2) throws InterruptedException { if (!bank.isOpen()) { if (!players.myPlayer().isAnimating() && inventory.getItem(item1).interact()) { return inventory.getItem(item2).interact(); // } } return false; } public boolean interactItems2(String item1, String item2) throws InterruptedException { if (!bank.isOpen()) { if (inventory.getItem(item1).interact("Use")) { return inventory.getItem(item2).interact(); // } } return false; } public boolean amIAnimating() throws InterruptedException{ for(int i = 0; i < 5; i++){ if(myPlayer().isAnimating() || players.myPlayer().isMoving()) return true; else sleep(100); } return false; } public String format(long time) { StringBuilder string = new StringBuilder(); long totalSeconds = time / 1000L; long totalMinutes = totalSeconds / 60L; long totalHours = totalMinutes / 60L; int seconds = (int)totalSeconds % 60; int minutes = (int)totalMinutes % 60; int hours = (int)totalHours % 24; if (hours > 0) { string.append(hours + "h "); } if (minutes > 0) { string.append(minutes + "m "); } string.append(seconds +"s"); return string.toString(); } public int getHourlyRate(int variable) { return (int)((variable - 0) * 3600000.0D / (System.currentTimeMillis() - this.startTime)); } private final RenderingHints antialiasing = new RenderingHints( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); private Image getImage(String url) { try { return ImageIO.read(new URL(url)); } catch(IOException e) { return null; } } private final Color color1 = new Color(0, 0, 0, 200); private final Color color2 = new Color(255, 0, 0); private final BasicStroke stroke1 = new BasicStroke(1); private final Font font1 = new Font("Arial", 0, 12); private final Image img1 = getImage("http://i.imgur.com/tyqNd5y.png"); @Override public void onPaint(Graphics2D g) { long xpGain = getSkills().getExperience(Skill.COOKING) - startEXP; g.setRenderingHints(antialiasing); g.setColor(color1); g.fillRect(548, 396, 191, 69); g.setColor(color2); g.setStroke(stroke1); g.drawRect(548, 396, 191, 69); g.setColor(color1); g.fillRect(599, 378, 96, 16); g.setColor(color2); g.drawRect(599, 378, 96, 16); g.setFont(font1); g.drawString("Tuna Potatoes", 605, 390); g.drawImage(img1, 659, 345, null); g.drawString("Runtime: " + format((System.currentTimeMillis()-startTime)), 555, 410); g.drawString("EXP Gained: " +xpGain, 555, 425); g.drawString("EXP/Hour: " + NumberFormat.getIntegerInstance().format(xpGain *3600000D / (System.currentTimeMillis() - startTime)), 555, 440); g.drawString("State: " + state, 555, 455); } public class GUI extends JFrame { private static final long serialVersionUID = 1L; private JPanel contentPane; @SuppressWarnings({ "rawtypes", "unchecked" }) public GUI() { setTitle("Tuna Potatoes"); setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); setBounds(100, 100, 240, 101); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); final JComboBox comboBox = new JComboBox(); comboBox.setModel(new DefaultComboBoxModel(new String[] {"Sweetcorn", "Tuna", "Potato", "Butter on potato", "Cut tuna", "Sweetcorn on tuna", "Potato on tuna", "Pattern mode"})); comboBox.setBounds(10, 11, 212, 20); contentPane.add(comboBox); JButton btnStart = new JButton("Start"); btnStart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { startTime = System.currentTimeMillis(); if (comboBox.getSelectedItem().equals("Sweetcorn")) { sweetcorn = true; } if (comboBox.getSelectedItem().equals("Potato")) { potato = true; } if (comboBox.getSelectedItem().equals("Tuna")) { tuna = true; } if (comboBox.getSelectedItem().equals("Butter on potato")) { butteronpotato = true; } if (comboBox.getSelectedItem().equals("Cut tuna")) { cuttuna = true; } if (comboBox.getSelectedItem().equals("Sweetcorn on tuna")) { sweetcornontuna = true; } if (comboBox.getSelectedItem().equals("Potato on tuna")) { potatoandtuna = true; } if (comboBox.getSelectedItem().equals("Pattern mode")) { log("Pattern mode started"); patternMode = true; sweetcorn = true; } guiWait = false; g.setVisible(false); } }); btnStart.setBounds(71, 42, 89, 23); contentPane.add(btnStart); } } @Override public void onExit() throws InterruptedException { long xpGain = getSkills().getExperience(Skill.COOKING) - startEXP; log("Runtime: " + format((System.currentTimeMillis()-startTime))); log("EXP Gained: " + xpGain); log("EXP/HR: " + NumberFormat.getIntegerInstance().format(xpGain *3600000D / (System.currentTimeMillis() - startTime))); } } I meant clean as in no malicious code lvlup = widgets.get(233, 11); //lvl up screen cont = widgets.get(233, 2); //continue if (lvlup != null) { cont.interact("Continue"); } can be if (getDialogues().isPendingContinuation()) { getDialogues().clickContinue(); } Edited January 27, 2016 by Assnerd Quote Link to comment Share on other sites More sharing options...
Salty as fuck Posted January 27, 2016 Author Share Posted January 27, 2016 I meant clean as in no malicious code lvlup = widgets.get(233, 11); //lvl up screen cont = widgets.get(233, 2); //continue if (lvlup != null) { cont.interact("Continue"); } can be if (getDialogues().isPendingContinuation()) { getDialogues().clickContinue(); } I know what you meant Oh my, that seems a lot more convenient.. I was initializing the widgets regularly as you can tell.. w1, w2, w3... I should probably go skim through the API. It's been two years since I last checked lol. Quote Link to comment Share on other sites More sharing options...
Animos Posted January 27, 2016 Share Posted January 27, 2016 I know what you meant Oh my, that seems a lot more convenient.. I was initializing the widgets regularly as you can tell.. w1, w2, w3... I should probably go skim through the API. It's been two years since I last checked lol. 2 years it was OSbot 1, so they API have chaned a lot. Quote Link to comment Share on other sites More sharing options...
Salty as fuck Posted January 27, 2016 Author Share Posted January 27, 2016 2 years it was OSbot 1, so they API have chaned a lot. The API was pretty ugly back then.. I'm glad things have changed. Quote Link to comment Share on other sites More sharing options...
Animos Posted January 28, 2016 Share Posted January 28, 2016 http://pastebin.com/p5xc2DxK Quote Link to comment Share on other sites More sharing options...
LoudPacks Posted January 28, 2016 Share Posted January 28, 2016 (edited) why u do dis. Now the prices will really crash. There's a paid one on the SDN.... so you basically just screwed all of them. :salty: Edited January 28, 2016 by LoudPacks 1 Quote Link to comment Share on other sites More sharing options...
Salty as fuck Posted January 28, 2016 Author Share Posted January 28, 2016 (edited) why u do dis. Now the prices will really crash. There's a paid one on the SDN.... so you basically just screwed all of them. yes, I saw your paid script. http://pastebin.com/p5xc2DxK gimme a short while, my farming accounts were banned do you know exactly what happened? can you replicate it? cause it just looks like for some reason it wasn't able to use an item on another item Edited January 28, 2016 by Reminiscence Quote Link to comment Share on other sites More sharing options...
KEVzilla Posted January 28, 2016 Share Posted January 28, 2016 (edited) I see you use often == true That is unnecassary. You can do: if (something) { ... } Instead of: if (something == true) { ... } Same goes for false: if (!something) { ... } Instead of: if (something == false) { ... } Edited January 28, 2016 by KEVzilla Quote Link to comment Share on other sites More sharing options...