DtohhM8 4 Share Posted September 15, 2019 package dtohh; import libs.AntiBanScript; import libs.BankingScript; import org.dreambot.api.script.AbstractScript; import org.dreambot.api.script.Category; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.wrappers.interactive.NPC; import org.dreambot.api.wrappers.items.GroundItem; @ScriptManifest( author = "Dtohh", category = Category.MONEYMAKING, name = "Cow n Hide", version = 1.0, description = "Kills cows and collects their hides. Also banks." ) 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 { NPC cow = getNpcs().closest(o -> o.getName().equalsIgnoreCase("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() { } } BankingScript: package libs; import dtohh.Main; import org.dreambot.api.methods.map.Tile; 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(); } } } AntiBanScript: package libs; import dtohh.Main; import org.dreambot.api.methods.map.Tile; 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); } } Utils: package libs; public class Utils { public static int generateRandomInt(double max, double min) { return (int) Math.round(Math.random() * (max + 1 - min) + min); } } When I goto my Local scripts and try start it, nothing happens. Any ideas whats wrong? Link to comment Share on other sites More sharing options...
NovaGTX 106 Share Posted September 15, 2019 Link to comment Share on other sites More sharing options...
DtohhM8 4 Author Share Posted September 15, 2019 I'm new to this API, not much documentation on it or how to debug. I found the debug panel but I see no errors when I press start. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.