Jump to content

Select Menu option


twiztid4life

Recommended Posts

I cant for the life of my figure out how to manually select a menu option.

I can get the menu options but how do i move the mouse to the correct option that i want

 

Edit:

 

I think im on the right track now

 

I get the list of options 

figure out what position the option is at based on the action i want to do 

move the mouse down based on the position of the action

Edited by twiztid4life
Link to comment
Share on other sites

Yeah, you had it figured out precisely.

 

Here's a custom snippet (Credits go to Toph): 

	public boolean selectMenuOption(String action, String noun) throws InterruptedException
	{
		if (!s.client.isMenuOpen()) return false;
		boolean found = false;
		int index = 0;
		List<Option> menu = s.client.getMenu();
		for (; index < menu.size(); index++)
		{
			if (menu.get(index).action.equals(action) && menu.get(index).noun.contains(noun))
			{
				found = true;
				break;
			}
		}
		if (found)
		{
			int x = s.client.getMenuX();
			int y = s.client.getMenuY() + 21 + index * 14;
			return s.client.moveMouseTo(new RectangleDestination(x, y, s.client.getMenuWidth(), 10), false, true, false);
		}
		s.moveMouseOutsideScreen();
		return false;
	}

Edited by Deffiliate
Link to comment
Share on other sites

 

Yeah, you had it figured out precisely.

 

Here's a custom snippet (Credits go to Toph): 

	public boolean selectMenuOption(String action, String noun) throws InterruptedException
	{
		if (!s.client.isMenuOpen()) return false;
		boolean found = false;
		int index = 0;
		List<Option> menu = s.client.getMenu();
		for (; index < menu.size(); index++)
		{
			if (menu.get(index).action.equals(action) && menu.get(index).noun.contains(noun))
			{
				found = true;
				break;
			}
		}
		if (found)
		{
			int x = s.client.getMenuX();
			int y = s.client.getMenuY() + 21 + index * 14;
			return s.client.moveMouseTo(new RectangleDestination(x, y, s.client.getMenuWidth(), 10), false, true, false);
		}
		s.moveMouseOutsideScreen();
		return false;
	}

 

It's + 19 + index * 15 actually.

  • Like 1
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...