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
  • Filter for clay rock for miner


    Oreo

    Recommended Posts

    Hey guys! Newbie scripter here. I'm making my own script to mine clay in West Varrock and I'm trying to make a quick filter for clay rocks, but I can't seem to filter it correctly.

     

    What I currently have it this:

       

    GameObject ClayRock = getGameObjects().closest(cr-> cr!=null && cr.getName().contains("Rocks") && cr.getModelColors() == 6705);

     

    I know it's wrong, but I don't know why it's wrong.

     

    I'm studying CS so any help will go a very long way for me, thanks!

    Link to comment
    Share on other sites

    I'm pretty sure that would just target any object with the name "Rocks." I only want to mine clay rocks, hence the ".getModelColors"

    Link to comment
    Share on other sites

    18 hours ago, Oreo said:

    I'm pretty sure that would just target any object with the name "Rocks." I only want to mine clay rocks, hence the ".getModelColors"

    He is saying it should be .equals not .contains

    Link to comment
    Share on other sites

    5 hours ago, ajbinky said:

    He is saying it should be .equals not .contains

    .contains should always? return true if a string is .equals, so that's not the case.

    Here's the actual issue with the code - getModelColors returns short[]

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

     

    Try this instead:

    GameObject ClayRock = getGameObjects().closest(cr-> cr != null && cr.getName().contains("Rocks") && cr.getModelColors().length > 0 && cr.getModelColors()[0] == 6705);

     

    Link to comment
    Share on other sites

    • 2 weeks later...
    On 7/20/2019 at 4:31 PM, beezdul said:

    .contains should always? return true if a string is .equals, so that's not the case.

    Here's the actual issue with the code - getModelColors returns short[]

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

     

    Try this instead:

    
    GameObject ClayRock = getGameObjects().closest(cr-> cr != null && cr.getName().contains("Rocks") && cr.getModelColors().length > 0 && cr.getModelColors()[0] == 6705);

    Late response, but thank you for clarifying this!

    Late response, but thank you for clarifying this!

    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.