Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • Script does nothing upon starting


    DtohhM8
     Share

    Recommended Posts

    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

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.