Jump to content

open 1 gate and ignore the other


trainux

Recommended Posts

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));
}

 

Link to comment
Share on other sites

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

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