Dab in a Lab Posted September 8, 2018 Posted September 8, 2018 I've been sitting on this project for a few weeks and decided I wasn't going to personally use it anymore. It is a pretty easy money maker to crash due to the low trade volume for rope. http://www.mediafire.com/file/25y3s8d22wgpn5b/Lab Certified_ Rope Buyer.jar I may add a fail safe for if the bot dies from a Dark Wizard. No promises though. Any constructive criticism or advice for my code would be appreciated. Source Code Spoiler import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.api.ui.Message; import org.osbot.rs07.api.ui.RS2Widget; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; @ScriptManifest(version = 1.0, info = "" , author = "Dab in a Lab", logo = "", name = "Lab Certified: Rope Buyer") public class Main extends Script { Area draynorBank = new Area(3092, 3242, 3093, 3245); Area ropeShop = new Area(3101,3258,3100,3257); Area GE = new Area(3162, 3487, 3167, 3484); @Override public void onStart() throws InterruptedException { log("Lets buy some ropes"); if (myPlayer().isOnScreen()) { if (!draynorBank.contains(myPlayer()) || (!ropeShop.contains(myPlayer()))) { if (getWalking().webWalk(draynorBank)) { log("Walking to draynor"); } } } } @Override public void onMessage(Message message) throws InterruptedException { log("Got a message"); RS2Widget rope = getWidgets().get(300, 16, 1); String msg = message.getMessage().toLowerCase(); if (msg.contains("you don't have enough inventory space.")) { getWalking().webWalk(draynorBank); new ConditionalSleep(40000, 1500) { @Override public boolean condition() throws InterruptedException { return draynorBank.contains(myPlayer()); } }.sleep(); //banking(); } else if (msg.contains("the shop has run out of stock.")) { int ropeAmount = rope.getItemAmount(); log("Shops out of stock"); new ConditionalSleep(10000, 1500) { int emptyCount = getInventory().getEmptySlotCount(); @Override public boolean condition() throws InterruptedException { return ropeAmount > emptyCount; } }.sleep(); rope.interact("Buy 10"); } if (msg.contains("welcome to runescape.")) { getWalking().webWalk(draynorBank); } } @Override public int onLoop() throws InterruptedException { RS2Object bank_booth = getObjects().closest("Bank booth"); int gpAmount = (int) getInventory().getAmount("Coins"); if (draynorBank.contains(myPlayer())) { /* if (gpAmount > 1000) { log("have a good amount of gp");*/ if (!getInventory().isEmptyExcept("Coins")) { banking(); } } else if (getWalking().webWalk(ropeShop)) { log("Walking to rope shop"); getDoorHandler().handleNextObstacle(ropeShop); new ConditionalSleep(45000, 1500) { @Override public boolean condition() throws InterruptedException { return ropeShop.contains(myPlayer()); } }.sleep(); } NPC roper = getNpcs().closest("Ned"); if (ropeShop.contains(myPlayer())) { roper.interact("Trade"); log("Trading Ned"); new ConditionalSleep(20000, 1500) { @Override public boolean condition() throws InterruptedException { return getStore().isOpen(); } }.sleep(); } else if (gpAmount > 1000) { log("have a good amount of gp"); if (getWalking().webWalk(ropeShop)) { log("Walking to rope shop as backup"); if (getDoorHandler().handleNextObstacle(ropeShop)) { new ConditionalSleep(45000, 1500) { @Override public boolean condition() throws InterruptedException { return ropeShop.contains(myPlayer()); } }.sleep(); roper.interact("Trade"); new ConditionalSleep(20000, 1500) { @Override public boolean condition() throws InterruptedException { return getStore().isOpen(); } }.sleep(); } } } else { getWalking().webWalk(GE); new ConditionalSleep(500000, 1500) { @Override public boolean condition() throws InterruptedException { return GE.contains(myPlayer()); } }.sleep(); if (GE.contains(myPlayer())) { stop(); } } RS2Widget rope = getWidgets().get(300, 16, 1); int ropeAmount = rope.getItemAmount(); int emptyCount = getInventory().getEmptySlotCount(); if (rope != null && rope.isVisible()) { log("See the rope"); new ConditionalSleep(45000, 1000) { @Override public boolean condition() throws InterruptedException { return rope.isVisible(); } }.sleep(); // if (ropeAmount + 15 > emptyCount) { rope.interact("Buy 50"); log("Buying rope"); new ConditionalSleep(20000, 1500) { @Override public boolean condition() throws InterruptedException { return getInventory().getEmptySlotCount() < emptyCount; } }.sleep(); /* }else { rope.interact("Buy 50"); new ConditionalSleep(330000, 1500) { @Override public boolean condition() throws InterruptedException { return getInventory().getEmptySlotCount() < emptyCount; } }.sleep();*/ new ConditionalSleep(200000, 1500) { @Override public boolean condition() throws InterruptedException { return getInventory().isFull(); } }.sleep(); if (getInventory().isFull()) getWalking().webWalk(draynorBank); } return 600; } private void banking () { RS2Object bank_booth = getObjects().closest("Bank booth"); if (getInventory().isFull() || getInventory().contains("Tinderbox")) { if (bank_booth.interact("Bank")) { new ConditionalSleep(4500, 1500) { @Override public boolean condition() throws InterruptedException { return getBank().isOpen(); } }.sleep(); if (getBank().isOpen()) getBank().depositAllExcept("Coins"); log("Depositing things"); new ConditionalSleep(4500, 1500) { @Override public boolean condition() throws InterruptedException { return getInventory().isEmptyExcept("Coins"); } }.sleep(); } } } @Override public void onExit() throws InterruptedException { log("Did good work today"); } }