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


    Balthazar

    Recommended Posts

    Posted

    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.

    Posted

    All of the log enum values should be fully capitalized (DEBUG, INFO, etc.), maybe that's your issue?

    Posted

    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.

    Posted

    You have to put the entire path there

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

     

    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.