_ynx Posted July 26, 2017 Posted July 26, 2017 (edited) Is it possble to track what position ingame the mouse is pointing to? (and likewise, where a position ingame corresponds to the (x,y) position on the client interface)? Edited July 26, 2017 by _ynx
_ynx Posted July 26, 2017 Author Posted July 26, 2017 (edited) 16 minutes ago, Muffins said: settigns -> mouse position I mean during runtime. i need to dynamically get what ingame position the mouse is pointed over and vice versa Edited July 26, 2017 by _ynx
Muffins Posted July 26, 2017 Posted July 26, 2017 5 minutes ago, _ynx said: I mean during runtime. i need to dynamically get what ingame position the mouse is pointed over and vice versa Yeah turn it on while the script is running lol, or you can use .getMousePosition in the API?
Explv Posted July 26, 2017 Posted July 26, 2017 (edited) 15 minutes ago, _ynx said: I mean during runtime. i need to dynamically get what ingame position the mouse is pointed over and vice versa You can do something like this to get the Position under mouse: public final Optional<Position> getPositionUnderMouse(final Point mousePosition) { for (int x = 0; x < 104; x++) { for (int y = 0; y < 104; y++) { Position pos = new Position(getMap().getBaseX() + x, getMap().getBaseY() + y, myPosition().getZ()); if (pos.isVisible(getBot()) && pos.getPolygon(getBot()).contains(mousePosition)) { return Optional.of(pos); } } } return Optional.empty(); } Usage: Position position = getPositionUnderMouse(getMouse().getPosition()); You cant really convert a Position to a mouse point, but you can get it's on screen Polygon: Polygon polygon = position.getPolygon(getBot()); Edited July 26, 2017 by Explv 5