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
  • Ending up with a bunch of errors


    Kirito

    Recommended Posts

    So i was following a tutorial from Dreamlicker after following the whole tutorial i ended up with 45 errors, 4 warnings and 2 typos.

    also after compiling the script it doesn't show up in the local scripts repository.

     

    package main;
     
    import org.dreambot.api.methods.Calculations;
    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 util.Wood;
    import static org.dreambot.api.Client.getClient;
    import static org.dreambot.api.methods.MethodProvider.sleepUntil;
     
     
    @ScriptManifest(category = Category.WOODCUTTING, name = "Simple Woodcutter", author = "Kirito", version = 1.0)
     
    public class mainclass extends AbstractScript{
     
        private int state = -1;
        private Wood currentLog;
        private boolean drop = true;
        //private int anInt;
     
        @Override
        public void onStart() {
            super.onStart();
            state = 0;
            currentLog = Wood.NORMAL;
        }
     
     
        @Override
        public int onLoop() {
            if (state == 0)
                cut();
            else {
     
                if (state == 1) {
                    bank();
                } else {
                    if (state == 2) {
                        drop();
                    }
                }
                return Calculations.random(300, 400);
            }
            return 0;
        }
     
        private void cut() {
            if (!getInventory().isFull()) {
                GameObject gO = getGameObjects().closest(f -> f.getName().equals(currentLog.getTreeName()));
                if (getLocalPlayer().distance(gO) > 5) {
                    getWalking().walk(gO);
                    sleepUntil(() -> !getLocalPlayer().isMoving()) || getLocalPlayer().distance(getClient().getDestination()) < 7, Calculations.random(4600, 5400);
                } else {
                    if (gO.Interact("Chop Down")) {
                        sleepUntil(() -> !gO.exists() || !getLocalPlayer().isAnimating(), Calculations.random(12000, 15000));
                    }
                } else{
                    if (drop) {
                        state = 2;
                    } else {
                        state = 1;
                    }
                }
            }
        }
     
        private void bank() {
            if (getBank().isOpen()) {
                getBank().depositAllExcept(f -> f.getName().contains("axe"));
                getBank().Close();
                sleepUntil(() -> !getBank().isOpen(), Calculations.random(2000, 2800));
                state = 0;
                if (getLocalPlayer().distance(getBank().getClosestBankLocation().getCenter()) > 5) {
                    if (getWalking().walk(getBank().getClosestBankLocation().getCenter()))
                        sleepUntil(() -> !getLocalPlayer().isMoving()
                                        || getLocalPlayer().distance(getClient().getDestination()) < 8
                                , Calculations.random(3500, 5000));
                } else {
                    getBank().open();
                    sleepUntil(() -> getBank().isOpen(), Calculations.random(2000, 2800));
     
                }
            }
        }
     
     
        private void drop() {
            if (getInventory().contains(currentLog.getLogName())) {
                getInventory().dropAll(currentLog.getLogName());
            } else {
                state = 0;
            }
        }
    }
    

    Current errors: Error:(53, 64) java: not a statement, Error:(53, 126) java ';' expected, Error:58, 15) java 'else' without 'if'

    if anyone could help me with this or tell me what i'm doing wrong i would be really gratefull.

     

    Link to comment
    Share on other sites

    You need to add script manifest annotation above your main class, that's why it doesn't show up in local repositary.

    @ScriptManifest(category = Category.WOODCUTTING, name = "NAME", author = "AUTHOR", version = 1.0)
    Link to comment
    Share on other sites

    What are the errors? Seems like you did not include the client.jar as a dependency.

    I did include the client.jar as you described in your video tutorial.

     

     

    You need to add script manifest annotation above your main class, that's why it doesn't show up in local repositary.

    @ScriptManifest(category = Category.WOODCUTTING, name = "NAME", author = "AUTHOR", version = 1.0)

    thx i totally forgot that part of the script lol.

     

     

     

    30cm2rp.png

    Link to comment
    Share on other sites

    You're missing a ; on line 45

    written as in the tutorial

    sleepUntill(() -> !getLocalPlayer().isMoving()
                            || getLocalPlayer().distance(getClient().getDestination()) < 7, Calculations.random(4600, 5400));
    
    Link to comment
    Share on other sites

    Click on script manifest and press alt + enter to import it, same for other api

    i already did that but now i keep getting incompatible. types found: 'import org.dreambot.api.script.Category', required: 'import org.dreambot.api.script.Category'

     

    while the category is already imported

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • 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.