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
  • Cannot get Logger.log() working (tutorial's minimum working example) [SOLVED]


    Recommended Posts

    Posted (edited)
    I'm trying, and failing, to run the test script from the tutorial,
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    
    @ScriptManifest(category = Category.MISC, name = "First Script", author = "me", version = 1.0)
    public class Main extends AbstractScript {
    
        @Override
        public int onLoop() {
            Logger.log("My first script!"); // this line throws an error
            sleep(2000);
            return 0;
        }
    }
    When I build the artifact I'm getting the error,
    
    C:\Users\me\IdeaProjects\First_Script\src\Main.java:20:9
    java: cannot find symbol
      symbol:   variable Logger
      location: class Main

    Without the `Logger.log` line the script builds and appears in the Dream Bot scripts folder and shows up in the Dream Bot client, so I think I've added client.jar as a library dependency correctly   (screenshot linked here).

    Am I missing an import? Or something simple?

    DreamBot Version: 3.22.7. JDK is Eclipse Temurin 21.0.1+12. IDE is IntelliJ IDEA Community version 2023.2.5. Project language level is the JDK default (21), changing it to 8 does not help.

    Edit: Adding the import

    Edited by apnasus
    Solved
    • apnasus changed the title to Cannot get Logger.log() working (tutorial's minimum working example) [SOLVED]
    Posted

    Adding,

    import org.dreambot.api.utilities.Logger;

    and changing project language level to 8 worked.

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