Zummy Posted August 13, 2018 Posted August 13, 2018 (edited) I want to mine only a certain set of rocks but I can't seem to exclude others, this is my pseudo code: RS2Object rock1 = getObjects().closest(7454); if (rock1.getGridX() != 10176){ // mine rock } Is there a proper way instead of looking at the object's grid coordinates? Thanks Edited August 13, 2018 by Zummy
Zummy Posted August 13, 2018 Author Posted August 13, 2018 (edited) Nevermind, I found the flaw. Apparently gridX can change? Edited August 13, 2018 by Zummy
Explv Posted August 13, 2018 Posted August 13, 2018 2 hours ago, Zummy said: I want to mine only a certain set of rocks but I can't seem to exclude others, this is my pseudo code: RS2Object rock1 = getObjects().closest(7454); if (rock1.getGridX() != 10176){ // mine rock } Is there a proper way instead of looking at the object's grid coordinates? Thanks 1. Use colours instead of IDs for rocks: 2. Use an Area to filter the rocks, not gridX and gridY: private static final Area ROCK_AREA = new Area(1, 2, 3, 4); RS2Object tinRock = getObjects().closest(obj -> ROCK_AREA.contains(obj) && Rock.TIN.hasOre(obj)); Areas can be calculated using the OSBot entity hover setting, or using my map https://explv.github.io/
Zummy Posted August 13, 2018 Author Posted August 13, 2018 1 hour ago, Explv said: 1. Use colours instead of IDs for rocks: 2. Use an Area to filter the rocks, not gridX and gridY: Areas can be calculated using the OSBot entity hover setting, or using my map https://explv.github.io/ Thank you again! I really appreciate all the help, that map tool is absolutely great! I do get a warning tho on my getObjects().closest() code -> Unchecked generics array creation for varargs parameter.
Explv Posted August 13, 2018 Posted August 13, 2018 10 minutes ago, Zummy said: Thank you again! I really appreciate all the help, that map tool is absolutely great! I do get a warning tho on my getObjects().closest() code -> Unchecked generics array creation for varargs parameter. You can ignore that warning
Zummy Posted August 13, 2018 Author Posted August 13, 2018 7 minutes ago, Explv said: You can ignore that warning Cool, thanks again!