Mouse Hopping

Discussion in 'Programming & Hardware' started by Liquid, Jun 27, 2015.

  1. Liquid

    Jul 13, 2014
    Likes Received:
    Making the mouse hop, e.g. 40 px down, is useful in cases such as replicating mouse key support - a feature endorsed by both RS3 and OSRS developers.

    I know mouse hopping used to be in the API, but now it seems unnecessarily difficult to implement. The following code shows the only way that I found that it was possible to achieve a mouse hop 40 px down:

    Code (Text):
    1. Mouse.setPathGenerator(new Mouse.PathGenerator() {
    2.     @Override
    3.     public boolean move(Interactable interactable, Filter<Point> filter, double v) {
    4.         return hop(new Point(Mouse.getPosition().x, Mouse.getPosition().y + 40));
    5.     }
    6. });

    This then requires wizardry to efficiently incorporate into a bot, by constantly changing the cached mouse path generator.

    The end product is pretty much the same as what the older API offered, but it was more messy to get there. This is an example of what I managed to cook up in a few minutes (not finalised):

    (Note: the bottom row of items cannot be dropped by mouse keys.)

    What I ask for is, either a suggestion to make my mouse hopping code more efficient, or an addition to the API such as Mouse#hop(Point).

    Peace, Liquid.
  2. Cloud

    Jul 28, 2013
    Likes Received:
    Mouse#hop(Point) was intentionally left out of the API because of it's massive potential for abuse. You can use the HOPPING_PATH_GENERATOR that's within the Mouse class as a generator and then use InteractablePoint#hover to force it to move to a specific point with a hop.

Share This Page