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
  • How to mine different types of rocks without classifying every type of rock to be the same


    Avali
     Share

    Recommended Posts

    I have this from another post I was looking at from a while ago https://pastebin.com/rpxL6wWJ and in that, am I right to think that this script says that every rock close to the local player is one and if the color doesn't match the color of the rock that has ore in it, it wont mine it.  Because I'm trying to write a script that will mine both copper and tin and then smelt it with the ability to bank ore and bars (I haven't gotten to making player smelt the ore, see as I'm asking how to mine) I already have areas setup for the different types of rocks to mine the ore at, but I don't know how to set the two types of rocks to be different. Also I need to figure out how to mine exactly half an inventory and then move to the next type of rock. Thanks!

    Link to comment
    Share on other sites

    Hey, have you checked the javadocs for getModelColors()

     https://dreambot.org/javadocs/org/dreambot/api/wrappers/interactive/GameObject.html#getModelColors--

     

    From another post:

     

    public enum Rock {
    
        CLAY(6705),
        COPPER(4645),
        TIN(53),
        IRON(2576),
        SILVER(74),
        COAL(10508),
        GOLD(8885),
        MITHRIL(-22239),
        ADAMANTITE(21662),
        RUNITE(-31437);
    
        public final short COLOUR;
    
        Rock(final int COLOUR) {
    
            this.COLOUR = (short) COLOUR;
        }
    }

     

    Example of usage:

    public GameObject getRockWithOre(Rock rock){
            return getGameObjects().closest(obj -> {
    
                short[] colours = obj.getModelColors();
    
                if(colours != null){
                    for(short c : colours){
    
                        if(c == rock.COLOUR) return true;
                    }
                }
                return false;
            });
        }

     

     

    Original post: 

     

    Link to comment
    Share on other sites

    10 minutes ago, Xtra said:

    Hey, have you checked the javadocs for getModelColors()

     https://dreambot.org/javadocs/org/dreambot/api/wrappers/interactive/GameObject.html#getModelColors--

     

    From another post:

     

    public enum Rock {
    
        CLAY(6705),
        COPPER(4645),
        TIN(53),
        IRON(2576),
        SILVER(74),
        COAL(10508),
        GOLD(8885),
        MITHRIL(-22239),
        ADAMANTITE(21662),
        RUNITE(-31437);
    
        public final short COLOUR;
    
        Rock(final int COLOUR) {
    
            this.COLOUR = (short) COLOUR;
        }
    }

     

    Example of usage:

    public GameObject getRockWithOre(Rock rock){
            return getGameObjects().closest(obj -> {
    
                short[] colours = obj.getModelColors();
    
                if(colours != null){
                    for(short c : colours){
    
                        if(c == rock.COLOUR) return true;
                    }
                }
                return false;
            });
        }

     

     

    Original post: 

     

    Thank you for the reply, but I don't understand how to implement that into my script. I didn't learn java I have sorta been piecing together code and learner java along the way. So I really only know one method so far. But I think if there is a way to set it to only click a object with a specific ID in a specific tile that would at least work for now. Because I'm not clicking on one tile/rock the areas I have setup have 2-3 rocks next to them so I don't need a respawn timer, just click on the next rock. So if you know how to do that, that would be great. Also I'm using enums and cases for my script.

    Link to comment
    Share on other sites

    If your knowledge really is too low to implement what was posted above then you may want to consider visiting some java learning resources before trying to go any further, as you're going to struggle.

    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.