Jump to content

Script getting stuck in a loop


Recommended Posts

Posted
	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

Posted

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;
		}
	};
Posted (edited)

 

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
Posted (edited)

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
Posted (edited)

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
Posted

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

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