Probability Posted November 2, 2019 Share Posted November 2, 2019 (edited) I'm in the process of writing a basic abyss runecrafting script. It requires some code to search out an obstacle like so: RS2Object boil = getObjects().getAll().stream().filter(obj -> obj.getName().equalsIgnoreCase("Boil")).findFirst().orElse(null); And then run to the obstacle, navigate it and move on. if (boil != null) { if (!innerring.contains(myPlayer())) { status = "found boil"; if (getWalking().walk(boil)) { status = "walking to boil"; if (boil.interact("Burn-down")) { status = "burning boil"; Timing.waitCondition(() -> innerring.contains(myPlayer()), random(5000, 6000)); } } } } However I'm noticing that it will often begin running to find the obstacle.....and then run straight past said obstacle for about 5-10 seconds before noticing. Then it will backtrack to the obstacle and continue on. Is there a way to make it just run to the obstacle without running straight past it? P.s. please feel free to rip on my noob code. Edited November 2, 2019 by Probability Quote Link to comment Share on other sites More sharing options...
BravoTaco Posted November 2, 2019 Share Posted November 2, 2019 You dont need to walk to it, as the interaction method will do this for you. Just check to see if it is not null than interact with it. 1 Quote Link to comment Share on other sites More sharing options...
Probability Posted November 3, 2019 Author Share Posted November 3, 2019 6 hours ago, BravoTaco said: You dont need to walk to it, as the interaction method will do this for you. Just check to see if it is not null than interact with it. It seems that without this bit of code, sometimes it will get into the abyss and not be able to find a boil locally. Then it will sit there, not being able to move. Quote Link to comment Share on other sites More sharing options...
Probability Posted November 3, 2019 Author Share Posted November 3, 2019 4 hours ago, Malcolm said: It’s possible for the object to not be null and not be visible and you won’t be able to interact with it so yes sometimes it’s best to walk to the object. you can try using setMinDistanceThreshold(0); and when you execute your event make an if statement to check completion there is a execute(e).isFinished(); method which will execute your event and you can use a conditional sleep until completion Thanks @Malcolm. Sounds like I should put something in the else part..maybe run a bit and then search for the boil again. if (boil != null) { ......... } else { run to another location } Quote Link to comment Share on other sites More sharing options...
Probability Posted November 4, 2019 Author Share Posted November 4, 2019 23 hours ago, Malcolm said: It’s possible for the object to not be null and not be visible and you won’t be able to interact with it so yes sometimes it’s best to walk to the object. you can try using setMinDistanceThreshold(0); and when you execute your event make an if statement to check completion there is a execute(e).isFinished(); method which will execute your event and you can use a conditional sleep until completion I'm not sure why but using setMinDistance Threshold doesn't seem to be working in this case (even with it set at 0). It still runs right past the boil for about 5 seconds, stops, rethinks and then goes to the correct point. It should be either running right near to the boil...or if it runs past, stops via the break condition. public void searchboil() throws InterruptedException { status = "searching for boil"; RS2Object boil = getObjects().getAll().stream().filter(obj -> obj.getName().equalsIgnoreCase("Boil")).findFirst().orElse(null); if (boil != null) { status = "boil not null"; sleep(250); runtoboil(); status = "attempting to interact with boil"; if (boil.interact("Burn-down")) { status = "burning boil"; Timing.waitCondition(() -> !myPlayer().isUnderAttack(), 5000); status = "wait condition end"; } // } } } public void runtoboil() throws InterruptedException { RS2Object boil = getObjects().closest("Boil"); status = "webwalking event to boil"; sleep(250); WalkingEvent myEvent = new WalkingEvent(boil.getArea(2)); //making the event myEvent.setMinDistanceThreshold(0); myEvent.setBreakCondition(new Condition() { @Override public boolean evaluate() { return boil.isVisible(); } }); execute(myEvent); } Quote Link to comment Share on other sites More sharing options...
Probability Posted November 4, 2019 Author Share Posted November 4, 2019 14 minutes ago, Malcolm said: Could try creating a small area/position just beside the boil and walking to that instead. Idk if the boils/eyes/whatever else is there changes positions or not. I can't quite remember. Yep they change positions, hence why I can't create a predefined area to go to. The below finds me the area and then should go to it...and it eventually does but keeps running past it for some reason. WalkingEvent myEvent = new WalkingEvent(boil.getArea(2)); Quote Link to comment Share on other sites More sharing options...