Jump to content

WebWalkingEvent.SetBreakCondition?


Trees

Recommended Posts

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;

   } 

});

Link to comment
Share on other sites


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;

}

Link to comment
Share on other sites


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 by LoudPacks
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...