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
  • Event mouse Left Click for Mining


    maferosrs

    Recommended Posts

    You already have it :D

    Thank you

    Now I do not get the getModelColors () method in the DreamBot API documentation, I'm going crazy T_T

     

    Reading the API documentation I got this https://dreambot.org/javadocs/org/dreambot/api/utilities/ColorPicker.html#getColorAt-int-int-

     

     

    isColor(int x, int y, java.awt.Color color)

    Checks if the color at the provided point matches the color provided

     

    and 

    getColorAt(int x, int y)

     

    It's interesting what can be done, but I can not do it with getColorAt(int x, int y)

    Link to comment
    Share on other sites

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

     

    Thats the standard now you have to add the check if you already interacting with the rock.

    GameObject rock = getGameObjects().closest(gameObject -> gameObject != null && gameObject.getName().equals("Rocks") && gameObject.getModelColors() != null);
    if(rock != null) {
      //Before you interacting with it check if you already did it. 
      rock.interact("Mine"); //Click on rock to mine it.
    }
    
    Link to comment
    Share on other sites

     

    ...

    rock = getGameObjects().closest(f -> f.getName().contains("Rock"));
    
    

    ty ty 

     

    How can I compare the color of the rock when it has mineral, and when it does not?

    package Miner;
    
    import javafx.scene.control.ColorPicker;
    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.utilities.Timer;
    import org.dreambot.api.wrappers.interactive.GameObject;
    
    import java.awt.*;
    
    @ScriptManifest(
            category = Category.MINING,
            name = "PowerMiner_10",
            author = "Mafer",
            version = 10.0 )
    public class Main extends AbstractScript{
        private int countOre;
        private GameObject rock;
        private GameObject goColor;
        private Timer timeInProgress = new Timer();
        private String itemCount = "Copper ore";
        private String status = "none";
    
        @Override
        public void onStart() {
            countOre = 0;
        }
    
        @Override
        public int onLoop() {
    
            countOre = getInventory().count(itemCount);
            int rockOn = 4645;
            int rockOFF = 436;
            int getColorRock = goColor.getModelColors();
    
            if( getColorRock == rockOn )
                rock = getGameObjects().closest(f -> f.getName().contains("Rock"));
                rock.interact("Mine");
            }
            return Calculations.random(1, 3);
        }
    

    How can I compare the color of the rock when it has mineral, and when it does not?

    Link to comment
    Share on other sites

    ty ty 

     

    How can I compare the color of the rock when it has mineral, and when it does not?

    package Miner;
    
    import javafx.scene.control.ColorPicker;
    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.utilities.Timer;
    import org.dreambot.api.wrappers.interactive.GameObject;
    
    import java.awt.*;
    
    @ScriptManifest(
            category = Category.MINING,
            name = "PowerMiner_10",
            author = "Mafer",
            version = 10.0 )
    public class Main extends AbstractScript{
        private int countOre;
        private GameObject rock;
        private GameObject goColor;
        private Timer timeInProgress = new Timer();
        private String itemCount = "Copper ore";
        private String status = "none";
    
        @Override
        public void onStart() {
            countOre = 0;
        }
    
        @Override
        public int onLoop() {
    
            countOre = getInventory().count(itemCount);
            int rockOn = 4645;
            int rockOFF = 436;
            int getColorRock = goColor.getModelColors();
    
            if( getColorRock == rockOn )
                rock = getGameObjects().closest(f -> f.getName().contains("Rock"));
                rock.interact("Mine");
            }
            return Calculations.random(1, 3);
        }
    

    How can I compare the color of the rock when it has mineral, and when it does not?

    getModelColors() returns an array, so you need to learn how arrays work.

    https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html

    Link to comment
    Share on other sites

    getModelColors() returns an array, so you need to learn how arrays work.

    https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html

    How can I compare the color of the rock when it has mineral, and when it does not?
    package Miner;
    
    import javafx.scene.control.ColorPicker;
    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.utilities.Timer;
    import org.dreambot.api.wrappers.interactive.GameObject;
    
    import java.awt.*;
    
    @ScriptManifest(
            category = Category.MINING,
            name = "PowerMiner_10",
            author = "Mafer",
            version = 10.0 )
    public class Main extends AbstractScript{
        private int countOre;
        private GameObject rock;
        private Timer timeInProgress = new Timer();
        private String itemCount = "Copper ore";
    
        @Override
        public void onStart() {
            countOre = 0;
        }
    
        @Override
        public int onLoop() {
    
            countOre = getInventory().count(itemCount);
            int[] rockOn = {4645,436};
            int[] getColorRock = getModelColors();
    
            if( getColorRock == rockOn )
                rock = getGameObjects().closest(f -> f.getName().contains("Rock"));
                rock.interact("Mine");
            }
            return Calculations.random(1, 3);
        }
    
    Link to comment
    Share on other sites

    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.