Jump to content

Rune Essence Portal Help


Recommended Posts

Posted (edited)

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
Posted
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"));

 

Posted
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

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

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