Veni Posted December 24, 2018 Share Posted December 24, 2018 (edited) I wrote this primarily to experiment with dialogue, banking, conditional sleeps, using multiple classes, etc. v .03 - Added Mind bombs/ Stouts/ Asgarnian ales due to request. Not going to bother updating source. Going to work on other projects now. The script will do the following: - Now can also buy Wizard Bombs / Stouts/ Asgarnian Ale in Falador. - Buys beers at the Port Sarim bar. - Deposits using the deposit box near the Entrana boat. - If you reach 0 or 1 gp, the script will check the bank for more and log out if you are out of GP or only have 1 coin left. Same logic for Falador, only 2 GP rather than 1. - Can walk from most areas to either bar. - Averages about 20k/hr based on a 50gp sell price. The current guide price is 56, but I understand that is a stretch to sell at this price. Progress report from my test on the script: The source for the old script is below, if anything is conventionally incorrect or redundant, please let me know. I am more of a C/C++ person and this is my first OSBOT script. Script should run fine, but if any issues arise I will fix them and update the JAR. JAR is attached to the post. Old script shell is below: Main.java package src; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(author = "Aftermath", name = "Beer Purchaser", info = "Buys beer at Port Sarim", version = 0.2, logo = "") public final class Main extends Script { private Tasks check; private Action action; int beers = 0; private long startedTime; public final Area Bar = new Area(3045, 3256, 3044, 3258); public final Area DepositBox = new Area(3047, 3236, 3043, 3236); public void onStart() { startedTime = System.currentTimeMillis(); check = new Tasks(this); action = new Action(this); } @Override public final int onLoop() throws InterruptedException { if (check.hasCoins() & (!check.needsDeposit())) { action.barWalk(); } else if (!check.hasCoins()) { action.coinCheck(); } if (!check.needsDeposit()) { action.talkToBartender(); action.buy(); } else if (check.needsDeposit()) { action.deposit(); } return random(150, 200); } public void onPaint(Graphics2D g) { Font font = new Font("Roman_Baseline", Font.ROMAN_BASELINE, 20); g.setColor(Color.RED); g.setFont(font); g.setFont(g.getFont().deriveFont(18.0f)); g.drawString("Beer Buyer", 20, 360); g.drawString("Beers purchased: " + (beers), 20, 375); g.drawString("Profit earned: " + (beers * 50), 20, 390); final long runTime = System.currentTimeMillis() - startedTime; g.drawString("Run time: " + (formatTime(runTime)), 20, 405); } public final String formatTime(final long ms) { long s = ms / 1000, m = s / 60, h = m / 60; s %= 60; m %= 60; h %= 24; return String.format("%02d:%02d:%02d", h, m, s); } } Tasks.java package src; import org.osbot.rs07.script.MethodProvider; public class Tasks extends MethodProvider { Main main; public Tasks(Main mainReference) { this.main = mainReference; } public boolean needsDeposit() { return (main.getInventory().isFull()); } public boolean hasCoins() { return (main.inventory.getAmount("Coins") > 1); } } Action.java package src; import org.osbot.rs07.api.map.constants.Banks; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.MethodProvider; import org.osbot.rs07.utility.ConditionalSleep; public class Action extends MethodProvider { Main main; public Action(Main mainReference) { this.main = mainReference; } public void barWalk() { if (!main.Bar.contains(main.myPosition())) { main.getWalking().webWalk(main.Bar); } } public void coinCheck() throws InterruptedException { if (!Banks.DRAYNOR.contains(main.myPosition())) { main.getWalking().webWalk(Banks.DRAYNOR); } else if (!main.getBank().isOpen()) { main.getBank().open(); } else if (main.inventory.getAmount("Coins") <= 1) { main.getBank().withdrawAll("Coins"); if (!main.getBank().contains("Coins") & (main.inventory.getAmount("Coins")) <= 1) { sleep(random(200, 400)); this.main.stop(); } } } public void deposit() throws InterruptedException { if (!main.DepositBox.contains(main.myPosition())) { main.getWalking().webWalk(main.DepositBox); } else if (main.DepositBox.contains(main.myPosition())) { main.objects.closest("Bank deposit box").interact("Deposit"); main.sleep(random(1000,2000)); new ConditionalSleep(5000) { public boolean condition() { return (!main.getDepositBox().isOpen()); } }.sleep(); } if (main.getDepositBox().isOpen()) { main.getDepositBox().depositAllExcept("Coins"); } } public void talkToBartender() throws InterruptedException { NPC bartender = main.npcs.closest("Bartender"); if (bartender != null) { bartender.interact("Talk-to"); new ConditionalSleep(10000) { public boolean condition() { return (main.getDialogues().inDialogue()); } }.sleep(); } } public void buy() throws InterruptedException { if (main.dialogues.inDialogue()) { main.dialogues.selectOption("Could I buy a beer please?"); sleep(random(400, 500)); if (main.dialogues.isPendingContinuation()) { sleep(random(400, 600)); main.dialogues.completeDialogue(); sleep(random(400, 500)); this.main.beers++; } } } } BeerPurchaser.jar Edited January 2, 2019 by Aftermath Quote Link to comment Share on other sites More sharing options...
doge24865 Posted December 25, 2018 Share Posted December 25, 2018 17 hours ago, Aftermath said: I wrote this primarily to experiment with dialogue, banking, conditional sleeps, using multiple classes, etc. The script will do the following: - Buys beers at the Port Sarim bar. - Deposits using the deposit box near the Entrana boat. - If you reach 0 or 1 gp, the script will check the bank for more and log out if you are out of GP or only have 1 coin left. - Can walk from most areas to the bar. - Averages about 20k/hr based on a 50gp sell price. The current guide price is 56, but I understand that is a stretch to sell at this price. Progress report from my test on the script: The source for the script is below, if anything is conventionally incorrect or redundant, please let me know. I am more of a C/C++ person and this is my first OSBOT script. Script should run fine, but if any issues arise I will fix them and update the source. Hoping to get some feedback. I didn't go very heavy on paint as this script is simple. JAR is attached to the post. Main.java package src; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(author = "Aftermath", name = "Beer Purchaser", info = "Buys beer at Port Sarim", version = 0.2, logo = "") public final class Main extends Script { private Tasks check; private Action action; int beers = 0; private long startedTime; public final Area Bar = new Area(3045, 3256, 3044, 3258); public final Area DepositBox = new Area(3047, 3236, 3043, 3236); public void onStart() { startedTime = System.currentTimeMillis(); check = new Tasks(this); action = new Action(this); } @Override public final int onLoop() throws InterruptedException { if (check.hasCoins() & (!check.needsDeposit())) { action.barWalk(); } else if (!check.hasCoins()) { action.coinCheck(); } if (!check.needsDeposit()) { action.talkToBartender(); action.buy(); } else if (check.needsDeposit()) { action.deposit(); } return random(150, 200); } public void onPaint(Graphics2D g) { Font font = new Font("Roman_Baseline", Font.ROMAN_BASELINE, 20); g.setColor(Color.RED); g.setFont(font); g.setFont(g.getFont().deriveFont(18.0f)); g.drawString("Beer Buyer", 20, 360); g.drawString("Beers purchased: " + (beers), 20, 375); g.drawString("Profit earned: " + (beers * 50), 20, 390); final long runTime = System.currentTimeMillis() - startedTime; g.drawString("Run time: " + (formatTime(runTime)), 20, 405); } public final String formatTime(final long ms) { long s = ms / 1000, m = s / 60, h = m / 60; s %= 60; m %= 60; h %= 24; return String.format("%02d:%02d:%02d", h, m, s); } } Tasks.java package src; import org.osbot.rs07.script.MethodProvider; public class Tasks extends MethodProvider { Main main; public Tasks(Main mainReference) { this.main = mainReference; } public boolean needsDeposit() { return (main.getInventory().isFull()); } public boolean hasCoins() { return (main.inventory.getAmount("Coins") > 1); } } Action.java package src; import org.osbot.rs07.api.map.constants.Banks; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.MethodProvider; import org.osbot.rs07.utility.ConditionalSleep; public class Action extends MethodProvider { Main main; public Action(Main mainReference) { this.main = mainReference; } public void barWalk() { if (!main.Bar.contains(main.myPosition())) { main.getWalking().webWalk(main.Bar); } } public void coinCheck() throws InterruptedException { if (!Banks.DRAYNOR.contains(main.myPosition())) { main.getWalking().webWalk(Banks.DRAYNOR); } else if (!main.getBank().isOpen()) { main.getBank().open(); } else if (main.inventory.getAmount("Coins") <= 1) { main.getBank().withdrawAll("Coins"); if (!main.getBank().contains("Coins") & (main.inventory.getAmount("Coins")) <= 1) { sleep(random(200, 400)); this.main.stop(); } } } public void deposit() throws InterruptedException { if (!main.DepositBox.contains(main.myPosition())) { main.getWalking().webWalk(main.DepositBox); } else if (main.DepositBox.contains(main.myPosition())) { main.objects.closest("Bank deposit box").interact("Deposit"); main.sleep(random(1000,2000)); new ConditionalSleep(5000) { public boolean condition() { return (!main.getDepositBox().isOpen()); } }.sleep(); } if (main.getDepositBox().isOpen()) { main.getDepositBox().depositAllExcept("Coins"); } } public void talkToBartender() throws InterruptedException { NPC bartender = main.npcs.closest("Bartender"); if (bartender != null) { bartender.interact("Talk-to"); new ConditionalSleep(10000) { public boolean condition() { return (main.getDialogues().inDialogue()); } }.sleep(); } } public void buy() throws InterruptedException { if (main.dialogues.inDialogue()) { main.dialogues.selectOption("Could I buy a beer please?"); sleep(random(400, 500)); if (main.dialogues.isPendingContinuation()) { sleep(random(400, 600)); main.dialogues.completeDialogue(); sleep(random(400, 500)); this.main.beers++; } } } } BeerPurchaser.jar Quote Link to comment Share on other sites More sharing options...
Veni Posted December 25, 2018 Author Share Posted December 25, 2018 @doge24865 Thanks for running the script and posting a prog. Quote Link to comment Share on other sites More sharing options...
doge24865 Posted December 25, 2018 Share Posted December 25, 2018 (edited) 1 hour ago, Aftermath said: @doge24865 Thanks for running the script and posting a prog. np personally the price for beer now a days is so bad its not even worth doing I maybe got 40 gp per beer so really might be worth it to make a bot for the wizard mind bombs in falador. 88gp each in the ge for them. Edited December 25, 2018 by doge24865 Quote Link to comment Share on other sites More sharing options...
Veni Posted December 25, 2018 Author Share Posted December 25, 2018 (edited) 1 hour ago, doge24865 said: np personally the price for beer now a days is so bad its not even worth doing I maybe got 40 gp per beer so really might be worth it to make a bot for the wizard mind bombs in falador. 88gp each in the ge for them. 6 I did notice they are definitely sinking in price. I will add mind bombs into the script soon. Probably in a day or two. Edited December 25, 2018 by Aftermath Quote Link to comment Share on other sites More sharing options...
doge24865 Posted December 26, 2018 Share Posted December 26, 2018 7 hours ago, Aftermath said: I did notice they are definitely sinking in price. I will add mind bombs into the script soon. Probably in a day or two. Yeah the bombs I think will be a lot more better atm. Quote Link to comment Share on other sites More sharing options...
fennecer Posted December 31, 2018 Share Posted December 31, 2018 (edited) I was selling them by the tens of thousands with another script because I was having such a low banrate. Maybe we dropped the price together. They were going for 88gp before I started. Mind bombs are decent but the Dwarven Stouts sell slow even at a dramatic price decrease. I'll give this script a try it has a better profit/beer counter. Will post you a proggy tomorrow hopefully. If you could add mind bombs that'd be dope. Edited December 31, 2018 by fennecer Quote Link to comment Share on other sites More sharing options...
Veni Posted January 2, 2019 Author Share Posted January 2, 2019 (edited) On 12/31/2018 at 4:40 PM, fennecer said: I was selling them by the tens of thousands with another script because I was having such a low banrate. Maybe we dropped the price together. They were going for 88gp before I started. Mind bombs are decent but the Dwarven Stouts sell slow even at a dramatic price decrease. I'll give this script a try it has a better profit/beer counter. Will post you a proggy tomorrow hopefully. If you could add mind bombs that'd be dope. 3 3 I wrote an update with a GUI that can do Mind Bombs/Stout/Asg. ale a few days ago. Thanks for reminding me. added the new jar file. Edited January 2, 2019 by Aftermath Quote Link to comment Share on other sites More sharing options...