Joseph Posted March 5, 2015 Share Posted March 5, 2015 How would someone find the position that is under our mouse? Quote Link to comment Share on other sites More sharing options...
Nas Posted March 5, 2015 Share Posted March 5, 2015 Entity hover debug i think Quote Link to comment Share on other sites More sharing options...
Twin Posted March 5, 2015 Share Posted March 5, 2015 (edited) mouse.getPosition() unless that's not what you wanted. Unless this gets the x/y of where the mouse is on the osbot client and not what's under the mouse, but I was under the impression that this gets the in game cords. Edited March 5, 2015 by twin 763 Quote Link to comment Share on other sites More sharing options...
Soldtodie Posted March 5, 2015 Share Posted March 5, 2015 (edited) public Position getPositionUnderMouse(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, getMap().getPlane()); if(pos.isVisible(getBot()) && pos.getPolygon(getBot()).contains(mousePosition)) { return pos; } } } return null; } Edited March 5, 2015 by Soldtodie Quote Link to comment Share on other sites More sharing options...
VladBots Posted March 5, 2015 Share Posted March 5, 2015 public Position getPositionUnderMouse(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, getMap().getPlane()); if(pos.isVisible(getBot()) && pos.getPolygon(getBot()).contains(mousePosition)) { return pos; } } } return null; } don't check all the tiles in the region, just get the tiles around the local player and check them (iirc the landscape only draws max 25 tiles from the cameras location) Quote Link to comment Share on other sites More sharing options...
Soldtodie Posted March 5, 2015 Share Posted March 5, 2015 don't check all the tiles in the region, just get the tiles around the local player and check them (iirc the landscape only draws max 25 tiles from the cameras location) When you want to get a position that is not loaded. Quote Link to comment Share on other sites More sharing options...
Botre Posted March 5, 2015 Share Posted March 5, 2015 public Position getPositionUnderMouse(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, getMap().getPlane()); if(pos.isVisible(getBot()) && pos.getPolygon(getBot()).contains(mousePosition)) { return pos; } } } return null; } If you use this, make sure you only call this method when clicking. Not the kind of method you want to call every couple of ms. Quote Link to comment Share on other sites More sharing options...
VladBots Posted March 5, 2015 Share Posted March 5, 2015 When you want to get a position that is not loaded. but your mouse can't be over a tile that isn't on camera. 1 Quote Link to comment Share on other sites More sharing options...
Soldtodie Posted March 5, 2015 Share Posted March 5, 2015 but your mouse can't be over a tile that isn't on camera. Possible but he don't ask for the best way. Anyway thx for the information. 1 Quote Link to comment Share on other sites More sharing options...
Joseph Posted March 5, 2015 Author Share Posted March 5, 2015 public Position getPositionUnderMouse(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, getMap().getPlane()); if(pos.isVisible(getBot()) && pos.getPolygon(getBot()).contains(mousePosition)) { return pos; } } } return null; } thanks for this you gave me the idea. don't check all the tiles in the region, just get the tiles around the local player and check them (iirc the landscape only draws max 25 tiles from the cameras location) thats exactly what im going to do. Thanks for the info If you use this, make sure you only call this method when clicking. Not the kind of method you want to call every couple of ms. i want it to be like the hover debug where it still me the current tile. Entity hover debug i think i want the api version mouse.getPosition() unless that's not what you wanted. Unless this gets the x/y of where the mouse is on the osbot client and not what's under the mouse, but I was under the impression that this gets the in game cords. that returns a point the x and y of the mouse position Quote Link to comment Share on other sites More sharing options...
Nas Posted March 5, 2015 Share Posted March 5, 2015 yeah sorry about that lol Quote Link to comment Share on other sites More sharing options...