Jump to content

Rune Essence Portal Help


BrainDeadGenius

Recommended Posts

I have the code, shown below, to exit the rune essence mine. It works 9/10 times, but in some instances, I am too far away from the portal. By 9/10 times, I mean it could happen once in 15 minutes, or once in 2-4 hours.

For some reason, it ends up grabbing another portal that's either too far away, or doesn't actually exist (at least, that's what it seemed like whilst debugging). Be it noted that the log for "Could not find the exit portal" is not being displayed while trying to exit through this portal, until I get closer.

Stream.concat(getNpcs().getAll().stream(), getObjects().getAll().stream())
	      	.filter(entity -> entity.getName().contains("Portal"))
	      	.min((portal1, portal2) -> Integer.compare(myPosition().distance(portal1.getPosition()), myPosition().distance(portal2.getPosition())))
	      	.ifPresent(portal -> {
	      		if (portal.interact("Exit", "Use", "Enter")) {
	      			new ConditionalSleep(10000) {
	      				@Override
	      				public boolean condition() throws InterruptedException {
	      					return teleportArea.contains(myPosition());
	      				}
	      			}.sleep();
	      		} else {
	      			log("Could not find the exit portal.");
	      		}
	      	});

 

myPosition.png

portalPosition.png

Edited by BrainDeadGenius
Link to comment
Share on other sites

1 minute ago, House said:

 

 

Just.. i edited my post with more details xD

read

The others used .closest("Portal") and it would work. Same setup with the name, just a different color. But I get that.

Best method is to use

exitPortalPlayer = getPlayers().closest(o -> o.getName().contains("Portal"));
exitPortalNPC = getNpcs().closest(o -> o.getName().contains("Portal"));
exitPortalEntity = getObjects().closest(o -> o.getName().contains("Portal"));

 

Link to comment
Share on other sites

1 minute ago, BrainDeadGenius said:

The others used .closest("Portal") and it would work. Same setup with the name, just a different color. But I get that.

Best method is to use


exitPortalPlayer = getPlayers().closest(o -> o.getName().contains("Portal"));
exitPortalNPC = getNpcs().closest(o -> o.getName().contains("Portal"));
exitPortalEntity = getObjects().closest(o -> o.getName().contains("Portal"));

 

 The reason it doesn't work is because of the unique color essentially yeah :p

Link to comment
Share on other sites

43 minutes ago, BrainDeadGenius said:

So, I've been trying to work out a rune essence miner. And I'm able to get everything to work of course, except for one thing. The portal to leave.

 

It looks like the portal changes ID's and names (The color is included in the name) randomly every 1-3 trips to the mine. That's no problem when you grab it by name. However, it also appears that the type of object you're trying to grab changes as well. Sometimes, the portal will be an NPC. Sometimes, it will be any form of object. And at other times, it might even be a player (haven't confirmed this yet). But, there's apparently another form of object that it can take that I have not accounted for. So, the portal returns null. View the GIF below. Suggestions are welcome.

 

https://gyazo.com/ede7dc8104e62b6ffd6ed4fcdea57c4d

 

This is what I used:

Stream.concat(getObjects().getAll().stream(), getNpcs().getAll().stream())
      .filter(entity -> entity.getName().contains("Portal"))
      .findAny()
      .ifPresent(portal -> {
          if (portal.interact("Use", "Exit")) {
              Sleep.sleepUntil(() -> !portal.isVisible(), 10_000);
          }
      });

 

  • Like 3
Link to comment
Share on other sites

6 minutes ago, Explv said:

 

This is what I used:


Stream.concat(getObjects().getAll().stream(), getNpcs().getAll().stream())
      .filter(entity -> entity.getName().contains("Portal"))
      .findAny()
      .ifPresent(portal -> {
          if (portal.interact("Use", "Exit")) {
              Sleep.sleepUntil(() -> !portal.isVisible(), 10_000);
          }
      });

 

The portal variable contains the correct information, but it's refusing to interact with it (I changed your sleep class to my own method).

Link to comment
Share on other sites

15 minutes ago, House said:

 

Maybe the interact is "Enter" ?

No, it's "Use", but I did add that to the list for future reference.

https://gyazo.com/c28af0887dddf60da0336e4a53ecf85d

That was a new occurrence, and it's worked so far since I've taken manual control for that one instance.

Edited by BrainDeadGenius
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...