Jump to content

WalkingEvent Questions


Recommended Posts

Posted

1. If I use a single instance WalkingEvent doesn't run after one execution. It seems that I have to instantiate a new event every time I want to run one. Why is this?

2. What is the exact maximum distance WalkingEvent will try to click? I noticed on my path I have many in-between points that are never clicked, so I'm guessing they are pointless to have.

3. Is there a way to set the distance from a point that the next point will be clicked? With WalkingEvent it seems to click the next point when it is within 2-3 squares, but WebWalkingEvent has a bigger lead which makes it look more natural (i.e. player doesn't slow down when it is close to the next Position).

Posted

API doesn't answer the latter two questions, but i took a look with a decompiler

	private boolean traversePath() {
		Object someObject = null;
		for (int i = linkedList.size() - 1; i >= 0; --i) {
			Position currentListPos;
			label35: {
				currentListPos = (Position) linkedList.get(i);
				if (myPosition().distance(currentListPos) >= miniMapDistanceThreshold) {
					if (!map.isMinimapLocked() && currentListPos.isOnMiniMap(bot)) {
						if (isOperateCamera && camera.getPitchAngle() < gRandom(40, 1.0D)) {
							camera.movePitch(random(40, 67));
						}

						someObject = new ClickMouseEvent(new MiniMapTileDestination(bot, currentListPos));
						break label35;
					}
				} else {
					if (!currentListPos.isVisible(bot)) {
						camera.toPosition(currentListPos);
					}

					(new WalkingEvent$1(this, 10000)).sleep();
					someObject = (new InteractionEvent(bot, currentListPos, "walk here")).setWalkTo(false);
				}
			}

			if (someObject != null) {
				execute((Event) someObject);
				if (((Event) someObject).hasFinished()) {
					(new WalkingEvent$2(bot, 6000, 500, currentListPos)).sleep();
					return true;
				}
			}
		}

		return false;
	}

	public class WalkingEvent$1 extends ConditionalSleep {
		public final WalkingEvent walkingEvent;

		public WalkingEvent$1(WalkingEvent walkingEvent, int timeout) {
			super(timeout);
			this.walkingEvent = walkingEvent;
		}

		public boolean condition() throws InterruptedException {
			return !myPlayer.isMoving();
		}
	}

	public class WalkingEvent$2 extends ConditionalSleep {
		public final WalkingEvent walkingEvent;
		public final Position position;

		public WalkingEvent$2(WalkingEvent walkingEvent, int timeout, int sleepTime, Position position) {
			super(timeout, sleepTime);
			this.walkingEvent = walkingEvent;
			this.position = position;
		}

		public boolean condition() {
			return myPlayer.getPosition().distance(currentListPos) < 4;
		}
	}

The second conditional sleep is being called between minimap clicks, timeout of 6 seconds with 500ms updates checking if player pos distance to next position is <= 3 tiles.

those need to be public vars :D?

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...