Oreo 0 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!
Oreo 0 Author 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"
ajbinky 13 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
beezdul 56 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);
Oreo 0 Author 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!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.