Jump to content

selecting menu action


Joseph

Recommended Posts

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.InterruptedException
    Selects 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
Link to comment
Share on other sites

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;
	}
Link to comment
Share on other sites

 

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;
 }
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...