Class GameObjectQuery

    • Constructor Detail

      • GameObjectQuery

        public GameObjectQuery​(Context ctx)
    • Method Detail

      • nameContains

        public GameObjectQuery nameContains​(java.lang.String name)
        Filters the stream of game objects for objects which match a specific substring of a name. For example: ctx.gameObjects().nameContains("Oak") will find Oak tree game objects in the scene.
        Overrides:
        nameContains in class AbstractQuery<GameObjectEntity,​GameObjectQuery,​net.runelite.api.GameObject>
        Parameters:
        name - The name to match against
        Returns:
        GameObjectQuery
      • interactable

        public GameObjectQuery interactable()
        Filters game objects to only contain objects which can be interacted with (non Examine) actions. i.e. Trees, Ore, Doors, Stairs etc...
        Returns:
        GameObjectQuery
      • withAction

        public GameObjectQuery withAction​(java.lang.String action)
        Filters for objects that have a specific action available. Usage: ctx.objects().withAction("Mine").nearest().first();
        Parameters:
        action - The action to check for i.e "Mine", "Chop", "Examine".
        Returns:
        GameObjectQuery
      • withPartialAction

        public GameObjectQuery withPartialAction​(java.lang.String actionSubstring)
        Filters the game objects to include only those with at least one action containing the specified substring.

        This method is case-insensitive and matches the specified substring against all non-null action strings associated with the game object.

        Parameters:
        actionSubstring - The substring to search for within the actions of the game objects. Must not be null.
        Returns:
        A GameObjectQuery with the applied filter to include only objects with actions matching the specified substring.
      • withinArea

        public GameObjectQuery withinArea​(net.runelite.api.coords.WorldPoint min,
                                          net.runelite.api.coords.WorldPoint max)
        Finds game objects within a specified area. The min WorldPoint should be the southwest tile of the area and the max WorldPoint should be the northeast tile of the area.
        Parameters:
        min - The southwest minimum world point of the area to check
        max - The northeast maximum world point of the area to check
        Returns:
        GameObjectQuery
      • reachable

        public GameObjectQuery reachable()
        Filters for only game objects which are reachable from the players current tile.
        Returns:
        GroundObjectQuery
      • nearest

        public GameObjectEntity nearest()
        Sorts the stream of game objects to order them by manhattan distance to the local player.
        Returns:
        GameObjectQuery
      • sortByDistance

        public GameObjectQuery sortByDistance()
        Sorts the game object stream by distance from the local players current location.
        Returns:
        GameObjectQuery
      • within

        public GameObjectQuery within​(net.runelite.api.coords.LocalPoint anchor,
                                      int distance)
        Filters for only objects whose location is within the specified distance from the anchor point.
        Parameters:
        anchor - The anchor local point.
        distance - The maximum distance from the anchor point (in local units).
        Returns:
        True if the object is within the specified distance from the anchor point, false otherwise.
      • within

        public GameObjectQuery within​(int distance)
        Filters for only objects whose location is within the specified distance from the players current local point.
        Parameters:
        distance - The maximum distance from the anchor point (in local units).
        Returns:
        True if the object is within the specified distance from the anchor point, false otherwise.
      • at

        public GameObjectQuery at​(net.runelite.api.coords.WorldPoint point)
        Filters by exact WorldPoint.
        Parameters:
        point - The world point to filter for entities on
        Returns:
        GameObjectQuery