Oreo 0 Share Posted July 19, 2019 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 More sharing options...
henrique190 7 Share Posted July 19, 2019 cr.getName().equals("Rocks")* Link to comment Share on other sites More sharing options...
Oreo 0 Author Share Posted July 19, 2019 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 More sharing options...
ajbinky 13 Share Posted July 20, 2019 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 More sharing options...
beezdul 56 Share Posted July 20, 2019 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 More sharing options...
Oreo 0 Author Share Posted August 2, 2019 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.