Jump to content

WalkingEvent Questions


ZoPP0Qp5r9xM

Recommended Posts

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

Link to comment
Share on other sites

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?

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