Trees Posted September 26, 2016 Posted September 26, 2016 How do you set a break condition? It says Condition cannot be instantiated as an object?
Chris Posted September 26, 2016 Posted September 26, 2016 walkEvent.setBreakCondition(new Condition() { @@Override public boolean evaluate() { return false; //condition to be met here } }); 2
Team Cape Posted September 26, 2016 Posted September 26, 2016 How do you set a break condition? It says Condition cannot be instantiated as an object? yeah you need to override one of its abstract methods e.g. Condition c = new Condition() { @@Override public boolean evaluate() { return myPosition().getX() >= 9005; } }; WebWalkingEvent w = new WebWalkingEvent(new Position(1, 2, 3); w.setBreakCondition©; or you could just do WebWalkingEvent w = new WebWalkingEvent(new Position(1, 2, 3); w.setBreakCondition(new Condition() { @@Override public boolean evaluate() { return myPosition().getX() >= 9005; } });
Mr Pro Pop Posted September 26, 2016 Posted September 26, 2016 public int onLoop() throws InterruptedException { RS2Object k = getObjects().closest("Tree"); if (!myPlayer().isAnimating()){ k.interact("Chop down"); new ConditionalSleep(2000) { @@Override public boolean condition() throws InterruptedException { return myPlayer().isAnimating(); } }.sleep(); } return 0; }
Sysm Posted September 26, 2016 Posted September 26, 2016 walkEvent.setBreakCondition(new Condition() { @[member='Override'] public boolean evaluate() { return false; //condition to be met here } }); lul stealing ballers profile pic 1
LoudPacks Posted September 26, 2016 Posted September 26, 2016 (edited) protected class WebWalk { private WebWalkEvent e = null; private boolean teleports = true; private boolean skills = false; private boolean quests = false; public void allowTeleports(boolean b) { teleports = b; } public void allowSkillLinked(boolean b) { skills = !b; } public void allowQuestLinked(boolean b) { quests = !b; } public void walk(Area walkArea, int thresh) { if (e == null || e.hasFailed() || e.hasFinished()) { e = new WebWalkEvent(walkArea); PathPreferenceProfile profile = new PathPreferenceProfile(); profile.setAllowTeleports(teleports); profile.ignoreAllSkillLinks(skills); profile.ignoreAllQuestLinks(quests); profile.checkInventoryForItems(true); e.setPathPreferenceProfile(profile); e.setBreakCondition(new Condition() { @@Override public boolean evaluate() { return false; } }); api.execute(e); } } } Edited September 26, 2016 by LoudPacks 1
Trees Posted September 26, 2016 Author Posted September 26, 2016 Can I just use the evalute event as sort of an update event? To do stuff while walking and return false so it doesn't stop the webwalking?