Jump to content

Script getting stuck in a loop


Twin

Recommended Posts

	case WALK_TO_WHEEL:
			status = "Walking to wheel";
			if (myPlayer().getZ() == 2) {
				this.localWalker.walkPath(BANK_TO_STAIRS);
				sleep(random(1500,2000));
				Entity stairs = objects.closest("Staircase");
				if (stairs != null
						&& stairs.exists()
						&& Arrays.asList(stairs.getDefinition().getActions())
								.contains("Climb-down"))
					stairs.interact("Climb-down");
				sleep(random(1000, 1200));
			}
			if (myPlayer().getZ() == 1) {
				Entity door = objects.closest(new Area(3207,3214,3208,3214),"Door");
				Entity wheel = objects.closest("Spinning wheel");
				if (door != null && door.exists())
					if (Arrays.asList(door.getDefinition().getActions())
							.contains("Open")) 
					{
						door.interact("Open");
						sleep(random(1500, 1600));
						this.localWalker.walk(wheel.getX(), wheel.getY() + 1);
						log("Hello");
					}
				this.localWalker.walk(wheel.getX(), wheel.getY() + 1);
				sleep(random(400, 500));

			}
			break;

So all my code works, everything else is flawless, except if it catches that the door contains open, then it opens the door then stands there. It reaches the cod under it, because i added a log check and it will spam it in chat. Can't figure it out

Link to comment
Share on other sites

Make a filter for the door with the following checks:

 

- hasAction("Open");

- getY() <= Y (y being the y coordinate of the door closer to the stairs, not the second door for rune mysteries)

 

if ^ that door exists, open it, if not, click the spinner and proceed with spinning.

	public static Filter<RS2Object> LUMBRIDGE_SOUTH_DOOR = new Filter<RS2Object>() {
		@Override
		public boolean match(RS2Object o) {
			if (o != null
					&& (o.hasAction("Open"))
					&& o.getY() < YYYY
					&& o.getName().equalsIgnoreCase("Door")) {
				return true;
			}
			return false;
		}
	};
Link to comment
Share on other sites

 

Make a filter for the door with the following checks:

 

- hasAction("Open");

- getY() <= Y (y being the y coordinate of the door closer to the stairs, not the second door for rune mysteries)

 

if ^ that door exists, open it, if not, click the spinner and proceed with spinning.

	public static Filter<RS2Object> LUMBRIDGE_SOUTH_DOOR = new Filter<RS2Object>() {
		@Override
		public boolean match(RS2Object o) {
			if (o != null
					&& (o.hasAction("Open"))
					&& o.getY() < YYYY
					&& o.getName().equalsIgnoreCase("Door")) {
				return true;
			}
			return false;
		}
	};

 

So then instead of having all those checks I can just have LUMBIDGESOUTHDOOR? since it's already being filtered?

 

Edited by twin 763
Link to comment
Share on other sites

You forgot to add spinningWheel.interact("Use"), that's why it's not doing anything

 

I have that in my other case, Once it gets into the spinning room, it executes the SPIN case, i guess i can try extending the area out a few blocks.

 

That actually fixed it lol, gonna see how reliable this is.

Edited by twin 763
Link to comment
Share on other sites

Ah I guess you can make it so if the closed door doesn't exist, then go to the SPIN case (use the spinning wheel)

 

(lumbridgeDoor == null || area.contains(myPosition) to set the SPIN state, otherwise it will just walk to the room redundantly, when it can just click the spinning wheel and immediately start spinning ;)

Edited by Czar
Link to comment
Share on other sites

Ah I guess you can make it so if the closed door doesn't exist, then go to the SPIN case (use the spinning wheel)

 

(lumbridgeDoor == null || area.contains(myPosition) to set the SPIN state, otherwise it will just walk to the room redundantly, when it can just click the spinning wheel and immediately start spinning wink.png

 

 I'll mess around with both ways tomorrow, when i got to get my proggies done

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