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
  • My java does not support this code HELP ME PLS


    julord
     Share

    Recommended Posts

    Hi everyone

    My java  does not support this code. How do I change it to my code work??

        private void chopTree(String nameOfTree){
            GameObject tree = getGameObjects().closest(gameObject -> gameObject != null && gameObject.getName().equals(nameOfTree));
            if(tree != null && tree.interact("Chop down")){
                int countLog = getInventory().count("Logs");
                sleepUntil(() -> getInventory().count("Logs") > countLog, 12000);
       
    

    My version java: 1.8.0_121

     

    Please help :)

     

     

     

    The entire script:

    package BasicWoodcutter;
    
    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.methods.filter.Filter;
    import org.dreambot.api.methods.map.Area;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.wrappers.interactive.GameObject;
    import org.dreambot.api.wrappers.interactive.NPC;
    
    import java.awt.*;
    
    /**
     * Created by Computor on 7/8/2015.
     */
    @ScriptManifest(category = Category.WOODCUTTING, name = "Basic WoodCutter", author = "Computor", version = 1.0)
    public class MainClass extends AbstractScript{
    
        Area bankArea = new Area(3092, 3240, 3097, 3246, 0);
        Area treeArea = new Area(3091, 3290, 3072, 3310, 0);
    
        @Override
        public void onStart(){
            log("Hi");
        }
    
        @Override
        public int onLoop() {
            /**
             * Chopping trees: Time to chop some trees, our inventory isn't full. We want to fill it up.
             */
            if(!getInventory().isFull()){
                if(treeArea.contains(getLocalPlayer())){
                    chopTree("Tree"); //change "Tree" to the name of your tree.
                }else{
                    if(getWalking().walk(treeArea.getRandomTile())){
                        sleep(Calculations.random(3000, 5500));
                    }
                }
            }
    
            /**
             * Banking: Time to bank our logs. Our inventory is full, we want to empty it.
             */
            if(getInventory().isFull()){ //it is time to bank
                if(bankArea.contains(getLocalPlayer())){
                    bank();
                }else{
                    if(getWalking().walk(bankArea.getRandomTile())){
                        sleep(Calculations.random(3000, 6000));
                    }
                }
            }
    
            return 600;
        }
    
        @Override
        public void onExit() {
            log("Bye");
        }
    
        @Override
        public void onPaint(Graphics graphics) {
    
        }
    
        private void chopTree(String nameOfTree){
            GameObject tree = getGameObjects().closest(gameObject -> gameObject != null && gameObject.getName().equals(nameOfTree));
            if(tree != null && tree.interact("Chop down")){
                int countLog = getInventory().count("Logs");
                sleepUntil(() -> getInventory().count("Logs") > countLog, 12000);
            }
        }
    
        private void bank(){
            NPC banker = getNpcs().closest(npc -> npc != null && npc.hasAction("Bank"));
            if(banker != null && banker.interact("Bank")){
                if(sleepUntil(() -> getBank().isOpen(), 9000)){
                    if(getBank().depositAllExcept(item -> item != null && item.getName().contains("axe"))){
                        if(sleepUntil(() -> !getInventory().isFull(), 8000)){
                            if(getBank().close()){
                                sleepUntil(() -> !getBank().isOpen(), 8000);
                            }
                        }
                    }
                }
            }
        }
    }
    

    the entire script

    Link to comment
    Share on other sites

    So, I added, but does not work and is not copied and pasted

     

    https://www.youtube.com/embed/YXsMRTcAm7o

     

     

     

    Please enable this movie in 4m 45s


     

     

    Thanks Im A Baller and then what do I do to make the script raised just clicked on a tree chop down


    Thank you, I did it.

    Super forum !!!!

    Edited by julord
    Link to comment
    Share on other sites

     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.