Jump to content

open 1 gate and ignore the other


Recommended Posts

Posted

I interact with a door, I open it if it is closed, but if this other gate is closed then it interacts with all the doors, I need it to be a specific door.

final int[] list = new int[] {1560, 1558};
final RS2Object gate = objects.closest(list);
if(gate.exists()) {
	interactCustom(gate, "Open");
	getWalking().walk(new Position(3180, 3288, 0));
}else{
	getWalking().webWalk(new Position(3088, 3235, 0));
}

 

Posted
6 minutes ago, trainux said:

How are they used?
Could you do an example, please?

ListInteger doorIds = new ArrayList<>();
doorIds.add(1560);
doorIds.add(1558); // I reckon better use positions (x, y)

if (!map.canReach(SOME_POSITION_BEYOND_GATE) {
	RS2Object gate = objects.closest(f -> doorIds.constains(f.getId()) && f.hasAction("Open"));
	if (gate != null) {
		gate.interact("Open");
    }	
} else {
walking.webwalk(SOME_POSITION_BEYOND_GATE);
}

Didn't test it, but should do the trick

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