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
  • Minotaur Killer


    javanotreal

    Recommended Posts

    Posted (edited)

    https://github.com/jamesjang/javanotrealscripts

     

    image.png.23c175f107d9ab03e8aad0435fcd63a6.png

     

    This is my second script, I had some more free time at work today and decided to give this a go because my first script served its purpose. I took the feedback from my previous thread and decided to put it up here. I didn't have time to fully finish it but will definitely try to finish it into a more complete version. 

    Some things I did differently from my previous script:

    - *ATTEMPT* to use proper naming conventions

    - Added GUI

    - Added a config 

    - Adopted the Tree node framework 

     

    Things I will add/try to add:

    - Custom pathing (for self-education purposes)

    - Antiban (referenced zenAntiban to add a couple features but I would like to add on to it)

     

     

     

    Edited by javanotreal
    wrong image
    Link to comment
    Share on other sites

    pretty sure you dont need Root.java if you just have a loop in your main class that instantiates the tree its extending

    package behavior;
    
    import org.dreambot.api.script.frameworks.treebranch.Branch;
    
    public class Root extends Branch {
    
        @Override
        public boolean isValid() {
            return true;
        }
    
    }

     

    And for GUI

    I highly recommend that you use the IntelliJ swing designer

    Link to comment
    Share on other sites

    11 hours ago, Luxe said:

    I highly recommend that you use the IntelliJ swing designer

    If you plan on releasing a script to the SDN, make sure you have IntelliJ configured to store the GUI as a java file. Pandemic said there's a way to have it make a .java file but I haven't bothered figuring it out yet. I learned this the hard way.

     

    First thing I'd like to highlight is the redundancy of your area checks. Namely,

    image.png.4408697382de061263b49ce3a59816de.png

    If you're not in the bank area, then the leaf will be validated and there's no need to check if you're not in the area in your onLoop.

     

    Overall, I see a common theme where you should be checking if the action is successful before sleeping. Most of dreambot's methods are booleans for this reason: if we successfully interact with something, then do a thing. Otherwise, do all this other code. Checking for successful actions will help prevent unnecessary sleeps.

    image.png.12bf66deca872d6af85152146d338222.png

    Try changing the above image (AttackMinotaurLeaf) with:

    if(monster.interact()){ sleep; }

     

    Another comment on the walk/bank loops. It looks like the bot will wait until it stops moving every time before walking again. Here's a brief example on how you could handle walking loops:

    // WALKING EXAMPLE:
    Tile tile = new Tile(0,0,0); // Example tile
    if(Walking.walk(tile)){ // Walk to the tile. If walk() returns true, we know we should sleep.
        // Sleep until we should walk with a random timeout between 900ms - 2000ms
        Sleep.sleepUntil(() -> Walking.shouldWalk(6), Calculations.random(900, 2000));
    }
    
    // BANKING EXAMPLE:
    if(Bank.open()){ // Try to open the bank. If true, it means the bank is already open or was opened successfully.
        if(Bank.contains("Salmon")){ // Check if the bank contains the salmon before withdrawing to prevent errors.
            // Do the withdrawal.
            Bank.withdrawAll("Salmon");
        } else if(!Bank.contains("Salmon") && !Inventory.contains("Salmon")) { // Check inventory for salmon as well.
            Logger.warn("Bank is out of food, killing script"); // I like to kill the script if a necessary item is missing.
            ScriptManager.getScriptManager().getCurrentScript().stop();
        }
    } else { // If Bank.open() returns false, it will start walking to the nearest bank and we should do a walking sleep.
        Sleep.sleepUntil(() -> Walking.shouldWalk(6), Calculations.random(800, 1950));
    }

     

    In your eat leaf, I don't like how you're sleeping until you're in an animation. I'd suggest sleeping until your inventory spaces are lower than before. However, if you ever deal with food that doesn't get completely consumed like pizza's or potions this will cause problems and you should come up with a better solution.

    int criticalThreshold = 20; // Threshold to break the sleep in the event you get combo'd tf out by the minotaur
    if(Inventory.contains("Salmon")){ // Check if the inventory has the salmon to prevent errors
        int initialEmptySlots = Inventory.getEmptySlots(); // Set the initial inventory space
        if(Inventory.interact("Salmon", "Eat")){ // Interact with the salmon
            // Sleep until the empty inventory slots are more than before, meaning we consumed it, or if the health drops below a critical threshold
            Sleep.sleepUntil(() -> Inventory.getEmptySlots() > initialEmptySlots || Players.getLocal().getHealthPercent() < criticalThreshold, 1800);
            MinotaursConfig.getMinoConfig().SetEatPercentage(GetEatPercentage()); // Set new eat percent
        }
    }
    Link to comment
    Share on other sites

    Posted (edited)

    I really really appreciate the feedback! I was out sick and off work for a couple days so I couldn't check but will definitely try to implement these changes and give it an update. 

     

    I'm also thinking that the setting might be this

    also updated the script with your feedback thanks. I used this from 40-62 strength and was fine for the most part. I think I will take what I learned here to create something more "fuller" rather than just a piece of content. Maybe try to upload something to SDN :)

    image.png.c17381afbac31add5b2b371c0203a330.png

    Edited by javanotreal
    updated script and didnt want to double post
    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
    ×
    ×
    • 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.