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
  • [Video Tutorial Series] | Dreambot Scripting | Request scripting tutorials here.


    Computor

    Recommended Posts

    Thats true :P I can learn some things from just looking at code but having a tutorial putting it to use in a video demonstration is always nice. AndIDontKnowHowToLookAtOtherScriptsCode.

    try this 

    public final String[] items = { "Big bones", "Limpwurt root" } // items you want to pick up
    
    
    
    
    puplic int onLoop() {
    
    GroundItem stuff = GroundItems.getNearest(items);
    
    //rest of the code
    
    }
    

    got this from http://dreambot.org/forums/index.php/topic/1963-complete-varrockge-pvp-world-looter-source/

    Link to comment
    Share on other sites

    • 2 weeks later...

    I've been trying to follow this guide. I've gotten to the sleep timer. I put it into the code just as you have. Then once I compile the script still spam clicks the tree and doesn't wait. I'm not sure what I am getting wrong? 

    package BasicWoodcutter;
    
    import org.dreambot.api.methods.filter.Filter;
    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 java.awt.*;
    
    /**
     * Created by metal on 9/21/2015.
     */
    @ScriptManifest(category = Category.WOODCUTTING, name = "Basic WoodCutter", author = "Metal", version = 1.0)
    public class MainClass extends AbstractScript{
    
        @Override
        public void onStart (){
            log("Hi");
        }
    
        @Override
        public int onLoop() {
            GameObject tree = getGameObjects().closest(gameObject -> gameObject != null && gameObject.getName().equals("Tree"));
            if(tree.interact("Chop down")){
                int countLog = getInventory().count("Logs");
                sleepUntil(() -> getInventory().count("Logs") > countLog, 8000);
            }
    
            return 600;
        }
    
        @Override
        public void onExit () {
    
        }
    
    
        @Override
        public void onPaint(Graphics graphics) {
    
        }
    }
    

    Any help would be appreciated. Also thank you for making these!

    Link to comment
    Share on other sites

    I've been trying to follow this guide. I've gotten to the sleep timer. I put it into the code just as you have. Then once I compile the script still spam clicks the tree and doesn't wait. I'm not sure what I am getting wrong? 

    package BasicWoodcutter;
    
    import org.dreambot.api.methods.filter.Filter;
    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 java.awt.*;
    
    /**
     * Created by metal on 9/21/2015.
     */
    @ScriptManifest(category = Category.WOODCUTTING, name = "Basic WoodCutter", author = "Metal", version = 1.0)
    public class MainClass extends AbstractScript{
    
        @Override
        public void onStart (){
            log("Hi");
        }
    
        @Override
        public int onLoop() {
            GameObject tree = getGameObjects().closest(gameObject -> gameObject != null && gameObject.getName().equals("Tree"));
            if(tree.interact("Chop down")){
                int countLog = getInventory().count("Logs");
                sleepUntil(() -> getInventory().count("Logs") > countLog, 8000);
            }
    
            return 600;
        }
    
        @Override
        public void onExit () {
    
        }
    
    
        @Override
        public void onPaint(Graphics graphics) {
    
        }
    }
    

    Any help would be appreciated. Also thank you for making these!

    Fixed :D

    Link to comment
    Share on other sites

    • 1 month later...

    Nice tut, Instead of sleeping for 8000 can we randomise it by saying calculation.random(5000,8000)? So everything is randomised?
    Assuming the calculation.random selects a number between 5 and 8 seconds?

    Link to comment
    Share on other sites

    Nice tut, Instead of sleeping for 8000 can we randomise it by saying calculation.random(5000,8000)? So everything is randomised?

    Assuming the calculation.random selects a number between 5 and 8 seconds?

     

    yep

    Link to comment
    Share on other sites

    • 3 weeks later...
    • 1 month later...

    When you use the script 

     

    if(tree != null && tree.interact("Chop down"))

     

    is it actually doing tree.interact even though it's a condition for the if statement? that's the only bit of code that's confusing me. I have no experience with Java so I don't know how this works 

    Link to comment
    Share on other sites

    When you use the script 

     

    if(tree != null && tree.interact("Chop down"))

     

    is it actually doing tree.interact even though it's a condition for the if statement? that's the only bit of code that's confusing me. I have no experience with Java so I don't know how this works 

    Yes, it will perform a nullcheck first and then interact "Chop down" with the tree. It will then only continue to the next line of code if BOTH conditions were met.

    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.