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
  • Resolving the MethodProvider.LogType Enum


    Balthazar
     Share

    Recommended Posts

    Hello! Starting to jump into programming again after a couple of years. Hopefully I can explain this.

    In the following example, I'm attempting to log the state of the game to the console. I want the type of the log to be 'Debug'. However, I cannot resolve the LogType enum.

    import org.dreambot.api.Client;
    import org.dreambot.api.methods.MethodProvider;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    
    @ScriptManifest(name = "Tutorial Island", description = "Tutorial script for Tutorial Island!", author = "Balthazar",
            version = 1.0, category = Category.MISC, image = "")
    
    public class Tutorial extends AbstractScript {
    
        @Override
        public int onLoop() {
            MethodProvider.log(MethodProvider.LogType.Debug, Client.getGameState().toString());
            return 1000;
        }
    
    }

     

    I've also tried the following. Thinking that it would resolve because the MethodProvider class is imported.

    import org.dreambot.api.methods.MethodProvider;
    
    ...
    ...
    
    MethodProvider.log(LogType.Debug, Client.getGameState().toString());

     

    My thoughts are that I'm missing something with the enum being embedded in another class? But, I'm not really certain.

    Link to comment
    Share on other sites

    Thank you! I fixed that. Still isn't resolving, unfortunately. I noticed that MethodProvider$LogType.DEBUG will successfully resolve. But, then I get a type mismatch because the log function is expecting LogType and not MethodProvider$LogType. Also, I'm not too certain why the $ is in there or why that resolves and MethodProvider.LogType doesn't. Couldn't find a good answer online.

    Edited by Balthazar
    Link to comment
    Share on other sites

    You have to put the entire path there

    MethodProvider.log(org.dreambot.api.methods.MethodProvider$LogType.ERROR, Client.getGameState().toString());

     

    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.