Jump to content

Accurate Interaction


Beau

Recommended Posts

  • 2 weeks later...
  • 11 months later...

I was trying to help you, don't act like a know it all when you just had a static sleep timer of 500-1500 please.

1) I'm not sure why you still think you're doing it right, but this:

2950fb51d2ecd38f4eb36b686fa697f2.png

NEVER GETS ANY OPTION. All it does is click, and that's assuming there's one thing on the cursor (you're not even checking that that's the correct entity, just that there's one there).

2) Your while loop just assures that the mouse gets moved to the bounding box. This could be good I guess, but it's kind of redundant when you could just return false if a menu is not open when you go to interact with it.

3) Fine if you're going to act like that I will:

public boolean interactNPC(NPC npc, String action) throws InterruptedException {	if (npc != null && npc.getDefinition().getActions() != null) {		Rectangle boundingBox = npc.getMouseDestination().getBoundingBox();		if (Arrays.asList(npc.getDefinition().getActions()).get(0).equalsIgnoreCase(action)) {			client.moveMouseTo(new RectangleDestination(boundingBox.x+5, boundingBox.y+5, boundingBox.width-10, boundingBox.height-10), false, false, false);			if (client.getEntitiesOnCursor().get(0).getName().equalsIgnoreCase(npc.getName())) {				client.clickMouse(false);				return true;			}			else {				client.moveMouseTo(new RectangleDestination(boundingBox.x+5, boundingBox.y+5, boundingBox.width-10, boundingBox.height-10), false, true, true);				return selectMenuOption(action);			}		}		else {			client.moveMouseTo(new RectangleDestination(boundingBox.x+5, boundingBox.y+5, boundingBox.width-10, boundingBox.height-10), false, true, true);			return selectMenuOption(action);		}	}	return false;}	public boolean selectMenuOption(String action) throws InterruptedException {	if (client.isMenuOpen()) {		List<Option> options = client.getMenu();		for (int i= 0; i < options.size(); i++) {			if (options.get(i).action.equalsIgnoreCase(action)) {				return client.moveMouseTo(new RectangleDestination(client.getMenuX(), client.getMenuY()+19+(i*15), client.getMenuWidth(), 15), false, true, false);			}		}	}	return false;}
Of course I could do more checking, but that can easily be accomplished by checking the boolean returned when the scripter calls the method.
can i use this in my scripts?
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...