Jump to content

How can I Interrupt a webwalk?


Recommended Posts

Posted (edited)

Once the webwalk is called, that's all the bot will focus on until the task is complete, but it doesn't handle al-kharid gate and I need a way to interrupt it mid event and interact with the gate:

		if (!getArea(location).contains(myPlayer())) {

			getWalking().webWalk(getArea(location).getRandomPosition());
			RS2Object gate = getObjects().closest("Gate");
			if (gate != null) {
				if (gate.hasAction("Pay-toll(10gp)")) {
					gate.interact("Pay-toll(10gp)");
				}
			}
                }

I also tried placing the gate interaction before the walk event but obviously that still doesn't work.

Edited by Paradox68
Posted (edited)

Walk via making a WebWalkEvent object, and use the method setBreakCondition(Condition breakCondition), then execute the event.

You need to make a Condition object that has the condition where you want the event to terminate.

Example:

Condition condition = new Condition() {
    @Override
    public boolean evaluate() {
        return getBank().isOpen(); 
    }
};
Edited by Chicken Wing
Posted (edited)

I know i'm dumb but I'm still learning. Can you tell me why this won't work?

http://pastebin.com/DgwrniXk

 

The reasons this doesn't work are too many to list.

 

Don't create your own webwalker, use the one osbot has made for you.

		INodeRouteFinder nodeFinder = INodeRouteFinder.createSimple();

		WebWalkEvent evt = new WebWalkEvent(nodeFinder, position);
		evt.setBreakCondition(new Condition() {

			@Override
			public boolean evaluate() {
				return getObjects().closest("Gate") != null;
			}
		});
                execute(evt);

In addition to this however, you also need to check that you're on the wrong side of the gate. Otherwise it's gonna keep breaking and going thru the gate even after passing it.

Edited by FrostBug
  • Like 1
Posted

The reasons this doesn't work are too many to list.

 

Don't create your own webwalker, use the one osbot has made for you.

		INodeRouteFinder nodeFinder = INodeRouteFinder.createSimple();

		WebWalkEvent evt = new WebWalkEvent(nodeFinder, position);
		evt.setBreakCondition(new Condition() {

			@Override
			public boolean evaluate() {
				return getObjects().closest("Gate") != null;
			}
		});
                execute(evt);

In addition to this however, you also need to check that you're on the wrong side of the gate. Otherwise it's gonna keep breaking and going thru the gate even after passing it.

 

 

mIhZEzR.gif

Posted

On the real though don't make a WWE use the osbot one.

If you confused about anything the bug said lmk I'll try my best to explain it. But follow the bugs suggestion please

 

 

I am a little confused. Do you think you could spare a minute on Teamviewer to let me know what creating your own WebWalkEvent consists of?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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