Beau Posted February 26, 2014 Author Share Posted February 26, 2014 I updated it, but there is always a problem with noted items. Quote Link to comment Share on other sites More sharing options...
Beau Posted March 9, 2014 Author Share Posted March 9, 2014 It's been a while since I've tested this out, but I looked at it and found that I wasn't checking for the entity name inside of the menu box. I fixed that and tested it out. Everything seems fine, it would be nice for people to test it out and criticize the worst. Quote Link to comment Share on other sites More sharing options...
AresScripts Posted March 2, 2015 Share Posted March 2, 2015 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: 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? Quote Link to comment Share on other sites More sharing options...
Swizzbeat Posted March 2, 2015 Share Posted March 2, 2015 can i use this in my scripts? idc but I'd optimize it since that codes pretty shitty Quote Link to comment Share on other sites More sharing options...
AresScripts Posted March 2, 2015 Share Posted March 2, 2015 idc but I'd optimize it since that codes pretty shittyIve just skimmed it so far. Ill look more into it tomorrow, but if i need help optimizing it can i ask you for tips Quote Link to comment Share on other sites More sharing options...