DtohhM8 4 Share Posted September 14, 2019 Main.java @ScriptManifest(author = "Dtohh", category = Category.WOODCUTTING, name = "Cow n Hide", version = 1.0) public class Main extends AbstractScript { protected BankingScript bank = new BankingScript(this); protected AntiBanScript antiBan = new AntiBanScript(this); @Override public void onStart() { bank.depositAll(); } @Override public int onLoop() { if(getInventory().isFull()) { bank.depositAll(); } else { GameObject cow = getGameObjects().closest("cow"); if(cow != null) { cow.interact("Attack"); sleepUntil(() -> !getLocalPlayer().isAnimating(), 5000); } else { // Try find some stuff to collect GroundItem cowHide = getGroundItems().closest("Cow Hide"); if(cowHide != null) { cowHide.interact("Pick Up"); sleepUntil(() -> !getLocalPlayer().isMoving(), 3000); sleep(500, 600); } else { antiBan.walkX(); antiBan.talk(); sleep(500,600); } } } return 600; } @Override public void onExit() { } } AntiBanScript.java public class AntiBanScript { private Main inst; public AntiBanScript(Main inst) { this.inst = inst; } public void walkX() { inst.getWalking().walk(new Tile(inst.getLocalPlayer().getTile().getX() +1, inst.getLocalPlayer().getTile().getY(), inst.getLocalPlayer().getTile().getZ())); inst.sleep(500, 600); } protected String[] scripts = new String[] { "This is so long", "What lvl are you?", "Anybody donating?", "Hows life?", "Hi all" }; public void talk() { inst.getKeyboard().type(scripts[Utils.generateRandomInt(scripts.length -1, 0)], true); } } BankingScript.java public class BankingScript { private Main inst; private Tile trainingPlace; public BankingScript(Main inst) { this.inst = inst; trainingPlace = inst.getLocalPlayer().getTile(); } protected boolean isInBankLocation() { return inst.getBank().getClosestBankLocation().getArea(3).contains(inst.getLocalPlayer()); } protected void walkToBankLocation() { inst.getWalking().walk(inst.getBank().getClosestBankLocation().getArea(3).getRandomTile()); inst.sleepUntil(() -> !inst.getLocalPlayer().isMoving(), 30000); } protected void walkBackToTrainingLocation() { inst.getWalking().walk(trainingPlace); inst.sleepUntil(() -> !inst.getLocalPlayer().isMoving(), 30000); } public void withdraw(String item) { if(isInBankLocation()) { inst.getBank().withdrawAll(item); inst.sleep(500,600); walkBackToTrainingLocation(); } else { walkToBankLocation(); } } public void depositAll() { if(isInBankLocation()) { inst.getBank().depositAllItems(); inst.sleep(500,600); walkBackToTrainingLocation(); } else { walkToBankLocation(); } } } Utils.java public class Utils { public static int generateRandomInt(double max, double min) { return (int) Math.round(Math.random() * (max + 1 - min) + min); } } App.java public class App { public static void main(String[] args) { new Main(); } } When I go to my project structures > artifacts and add a new jar from module dependencies and set the main class to App.java and the output directory to my DreamBot > plugins directory and try to open my local scripts in DreamBot it does not show. How can I export the Jar correctly? Link to comment Share on other sites More sharing options...
DtohhM8 4 Author Share Posted September 14, 2019 The error I get is when I try to run this script is: log4j:WARN No such property [conversionPattern] in org.apache.log4j.PatternLayout. log4j:WARN No such property [conversionPattern] in org.apache.log4j.PatternLayout. log4j:WARN No such property [maxFileSize] in org.apache.log4j.RollingFileAppender. log4j:WARN No such property [file] in org.apache.log4j.RollingFileAppender. log4j:WARN File option not set for appender [LocalFile]. log4j:WARN Are you using FileAppender instead of ConsoleAppender? Exception in thread "main" java.lang.NullPointerException at org.dreambot.api.methods.MethodContext.getLocalPlayer(MethodContext.java:186) at libs.BankingScript.<init>(BankingScript.java:14) at dtohh.Main.<init>(Main.java:13) at dtohh.App.main(App.java:5) Link to comment Share on other sites More sharing options...
DtohhM8 4 Author Share Posted September 14, 2019 My configuration: Link to comment Share on other sites More sharing options...
LostVirt 106 Share Posted September 14, 2019 have you tried this? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.