Sujamma Posted May 14, 2020 Author Posted May 14, 2020 1 hour ago, progamerz said: @Sujamma It doesn't work because theoretically, it never changes the value of gate again, so it is stored as an old object which is closed, what you can do is use this new ConditionalSleep(5000, 600) { @Override public boolean condition() { return getObjects().closest(o -> o.getName().equals("Gate") && o.getPosition().equals(gate.getPosition()) && !o.hasAction("Open")) != null; } }.sleep(); The way this works, is that it keeps checking every 600ms if the condition is true, here we are trying to find new object which has the same position as the gate which we interacted but is opened I used your code, but the bot is still standing still for 5 seconds and only then runs to the mill. I'll just leave it as is, the script works anyway. Thanks for the help.
progamerz Posted May 14, 2020 Posted May 14, 2020 15 minutes ago, Sujamma said: I used your code, but the bot is still standing still for 5 seconds and only then runs to the mill. I'll just leave it as is, the script works anyway. Thanks for the help. If you want you can post the code on something like pastebin and i can help, most probs its not from the conditional sleep
Sujamma Posted May 14, 2020 Author Posted May 14, 2020 22 minutes ago, progamerz said: If you want you can post the code on something like pastebin and i can help, most probs its not from the conditional sleep https://pastebin.com/nLaKc3NX It's my first time using pastebin, so tell me if something's wrong.
progamerz Posted May 14, 2020 Posted May 14, 2020 41 minutes ago, Sujamma said: https://pastebin.com/nLaKc3NX It's my first time using pastebin, so tell me if something's wrong. private void GoToMill2() throws InterruptedException { Position outsideMill = new Position(3166, 3300, 0); Position insideMill = new Position(3166, 3305, 0); if (!getMap().canReach(outsideMill)) { if (getDoorHandler().handleNextObstacle(outsideMill)) { ConditionalSleep2.sleep(5000, 500, () -> getMap().canReach(outsideMill)); } } else { WalkingEvent walk = new WalkingEvent(outsideMill); execute(walk); } // OR if (!getMap().canReach(outsideMill)) { RS2Object gate = getObjects().closest(o -> o.getName().equalsIgnoreCase("Gate") && o.hasAction("Open")); if (gate.interact("Open")) ConditionalSleep2.sleep(5000, 500, () -> getMap().canReach(outsideMill)); } else { WalkingEvent walk = new WalkingEvent(outsideMill); execute(walk); } } Basically the first method, it tries to use the DoorHandler API, which you pass in the position where you want to go to, and it will handle the obstacles, that will not let it reach the position https://osbot.org/api/org/osbot/rs07/api/DoorHandler.html The second method, is you handling the obstacle manually(without using the DoorHandler API) Both should work, but make sure to only keep one of the both methods. 1
Sujamma Posted May 14, 2020 Author Posted May 14, 2020 @progamerz I used the first one and DoorHandler works like a charm, I had no idea about that method. Many thanks. 1