trainux Posted June 5, 2018 Posted June 5, 2018 I interact with a door, I open it if it is closed, but if this other gate is closed then it interacts with all the doors, I need it to be a specific door. final int[] list = new int[] {1560, 1558}; final RS2Object gate = objects.closest(list); if(gate.exists()) { interactCustom(gate, "Open"); getWalking().walk(new Position(3180, 3288, 0)); }else{ getWalking().webWalk(new Position(3088, 3235, 0)); }
trainux Posted June 5, 2018 Author Posted June 5, 2018 4 minutes ago, Chris said: Use a filter How are they used? Could you do an example, please?
Chris Posted June 5, 2018 Posted June 5, 2018 final RS2Object gate = objects.closest(filter); http://osbot.org/api 1
Butters Posted June 5, 2018 Posted June 5, 2018 6 minutes ago, trainux said: How are they used? Could you do an example, please? ListInteger doorIds = new ArrayList<>(); doorIds.add(1560); doorIds.add(1558); // I reckon better use positions (x, y) if (!map.canReach(SOME_POSITION_BEYOND_GATE) { RS2Object gate = objects.closest(f -> doorIds.constains(f.getId()) && f.hasAction("Open")); if (gate != null) { gate.interact("Open"); } } else { walking.webwalk(SOME_POSITION_BEYOND_GATE); } Didn't test it, but should do the trick
Canidae Posted June 5, 2018 Posted June 5, 2018 Object IDs can change at any time, so you shouldn't rely on those. I recommend sticking with Position filtering instead.