Package rsb.methods

Class Menu

Direct Known Subclasses:
ChooseOption

public class Menu extends MethodProvider
Context menu related operations.
  • Method Details

    • doAction

      public boolean doAction(String action)
      Clicks the menu target. Will left-click if the menu item is the first, otherwise open menu and click the target.
      Parameters:
      action - The action (or action substring) to click.
      Returns:
      true if the menu item was clicked; otherwise false.
    • doAction

      public boolean doAction(String action, String... target)
      Clicks the menu target. Will left-click if the menu item is the first, otherwise open menu and click the target.
      Parameters:
      action - The action (or action substring) to click.
      target - The target (or target substring) of the action to click.
      Returns:
      true if the menu item was clicked; otherwise false.
    • itemHasAction

      public boolean itemHasAction(RSItem item, String action)
      Determines if the item contains the desired action.
      Parameters:
      item - The item to check.
      action - The item menu action to check.
      Returns:
      true if the item has the action; otherwise false.
    • clickIndex

      public boolean clickIndex(int i)
      Left clicks at the given index.
      Parameters:
      i - The index of the item.
      Returns:
      true if the mouse was clicked; otherwise false.
    • getLocation

      public Point getLocation()
    • isCollapsed

      public boolean isCollapsed()
      Checks whether the menu is collapsed.
      Returns:
      true if the menu is collapsed; otherwise false.
    • isOpen

      public boolean isOpen()
      Checks whether the menu is open.
      Returns:
      true if the menu is open; otherwise false.
    • stripFormatting

      public static String stripFormatting(String input)
      Strips HTML tags.
      Parameters:
      input - The string you want to parse.
      Returns:
      The parsed String.
    • getEntries

      public net.runelite.api.MenuEntry[] getEntries()
    • getEntriesString

      public String[] getEntriesString()
    • getActions

      public String[] getActions()
    • getTargets

      public String[] getTargets()
    • getIndex

      public int getIndex(String action)
      Returns the index in the menu for a given action. Starts at 0.
      Parameters:
      action - The action that you want the index of.
      Returns:
      The index of the given target in the context menu; otherwise -1.
    • getIndex

      public int getIndex(String action, String... target)
      Returns the index in the menu for a given action with a given target. Starts at 0.
      Parameters:
      action - The action of the menu entry of which you want the index.
      target - The target of the menu entry of which you want the index. If target is null, operates like getIndex(String action).
      Returns:
      The index of the given target in the context menu; otherwise -1.
    • contains

      public boolean contains(String action)
      Checks whether a given action (or action substring) is present in the menu.
      Parameters:
      action - The action or action substring.
      Returns:
      true if present, otherwise false.
    • contains

      public boolean contains(String action, String target)
      Checks whether a given action with given target is present in the menu.
      Parameters:
      action - The action or action substring.
      target - The target or target substring.
      Returns:
      true if present, otherwise false.