July 26, 20178 yr 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, 20178 yr by _ynx
July 26, 20178 yr Author 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, 20178 yr by _ynx
July 26, 20178 yr 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?
July 26, 20178 yr 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, 20178 yr by Explv
Create an account or sign in to comment