Joseph Posted May 26, 2014 Posted May 26, 2014 im not too sure of, how to select the first index off a open menu (off of right clicking). i know there, but i wouldnt know what to put for the destination selectOptionpublic boolean selectOption(java.lang.Object e,MouseDestination dest,java.lang.String action)throws java.lang.InterruptedExceptionSelects an option in a menu. Parameters: e - The entity object (Can be an instance of Entity or Item) dest - The destination of the destination. action - The action of the option, For example: 'Use' or 'Chop down' Returns: Throws: java.lang.InterruptedException
Precise Posted May 26, 2014 Posted May 26, 2014 i would do this. Then invoke this method after. it works for me
Joseph Posted May 26, 2014 Author Posted May 26, 2014 the stuggle lol, so far i have this, it works fine for the right clicking. Now i just need to add in menu slecetion public boolean menuContains(RS2Object object) { if (object != null && client.isMenuOpen()) { for (Option menu: client.getMenu()) { if (menu!=null && menu.action.equalsIgnoreCase(object.getDefinition().getActions()[0])) return true; } } return false; } public boolean rightClick(RS2Object object) throws InterruptedException { if (object != null && this.canReach(object)) { if (!client.isMenuOpen()) { client.moveMouseTo(object.getMouseDestination(), false, true, true); }else return this.menuContains(object); } return false; } public boolean interactWithRightClick(RS2Object object) throws InterruptedException{ return false; }
Precise Posted May 26, 2014 Posted May 26, 2014 the stuggle lol, so far i have this, it works fine for the right clicking. Now i just need to add in menu slecetion public boolean menuContains(RS2Object object) { if (object != null && client.isMenuOpen()) { for (Option menu: client.getMenu()) { if (menu!=null && menu.action.equalsIgnoreCase(object.getDefinition().getActions()[0])) return true; } } return false; } public boolean rightClick(RS2Object object) throws InterruptedException { if (object != null && this.canReach(object)) { if (!client.isMenuOpen()) { client.moveMouseTo(object.getMouseDestination(), false, true, true); }else return this.menuContains(object); } return false; } public boolean interactWithRightClick(RS2Object object) throws InterruptedException{ if(right } okay, how about this? private boolean selectOpenMenuOption(String name) throws InterruptedException { sA.log("Selecting Menu Option"); if (sA.client.isMenuOpen()) { List<Option> options = sA.client.getMenu(); for (int i= 0; i < options.size(); i++) { if (options.get(i).action.equalsIgnoreCase(name)) { return sA.client.moveMouseTo(new RectangleDestination(sA.client.getMenuX(), sA.client.getMenuY()+19+(i*15), sA.client.getMenuWidth(), 15), false, true, false); } } } return false; } private boolean rightClick(RS2Object object) throws InterruptedException { if (object != null && sA.canReach(object)) { return sA.client.moveMouseTo(object.getMouseDestination(), false, true, true); } return false; } public boolean interactWithRightClick(RS2Object object) throws InterruptedException{ if(rightClick(object)) { return selectOpenMenuOption(object.getDefinition().getActions()[0]); } return false; }