chardragon Posted August 11, 2023 Share Posted August 11, 2023 I am trying to make a simple agility script for Faldor which has two consecutive "Jump Ledges" and the bot currently chooses the previous one as its the closest whern using private String[] names = {"Rough wall", "Tightrope", "Hand holds", "Gap", "Gap", "Tightrope","Tightrope","Gap","Ledge","Ledge","Ledge","Ledge","Edge"}; // private int[] names = {14898, 14899, 14901, 14903, 14904, 14905,14911,14919,14920,14921,14923,14924,149251}; Entity previous; @Override public void onStart() { getExperienceTracker().start(Skill.AGILITY); } @Override public int onLoop() throws InterruptedException { int starting = getExperienceTracker().getGainedXP(Skill.AGILITY); Entity nextObj = getObjects().closest(obj -> Arrays.asList(names).contains(obj.getName()) && Arrays.asList(actions).contains(obj.getActions()[0]) && (getMap().canReach(obj)) && !obj.equals(previous)); log(nextObj.getId()); I am trying to implement the array of ids and have tried Entity nextObj = getObjects().closest(obj -> Arrays.asList(names).contains(obj.getId()) && Arrays.asList(actions).contains(obj.getActions()[0]) && (getMap().canReach(obj)) && !obj.equals(previous)); However it just creates nulls and breaks the script i was wondering how can i overcome this / the best way to achieve this. Quote Link to comment Share on other sites More sharing options...
Explv Posted August 11, 2023 Share Posted August 11, 2023 You can differentiate between them by the position of the object For example, one ledge is at Position(3011, 3343, 3), and the following is at Position(3012, 3334, 3) Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted August 11, 2023 Share Posted August 11, 2023 (edited) Ids, work exactly the same as names tbh, but that's most likely not going to solve your issue Make like an Enum with an RooftopArea + Object name + position + action and use that instead Add some area checks in there to know which roof you are on and which object to interact with so you can control what's going on. Edited August 11, 2023 by Khaleesi Quote Link to comment Share on other sites More sharing options...
chardragon Posted August 18, 2023 Author Share Posted August 18, 2023 On 8/11/2023 at 8:39 PM, Khaleesi said: Ids, work exactly the same as names tbh, but that's most likely not going to solve your issue Make like an Enum with an RooftopArea + Object name + position + action and use that instead Add some area checks in there to know which roof you are on and which object to interact with so you can control what's going on. Hi Thanks for the reply I actually managed to solve it by doing this getObjects().closest(obj -> Arrays.asList(ids).contains(Integer.toString(obj.getId())) and then making it an array of strings instead I'm not really sure why it wouldn't work with ints but there we go Quote Link to comment Share on other sites More sharing options...