AceKingSuited Posted January 21, 2020 Share Posted January 21, 2020 I was wanting to implement my own mouse movements generated via machine learning against human data. That being said, I don't want to go manually calculating coords and hitboxes if at all possible. Is there any way to override the default mouse movement when entity.interact is called? I'd basically like to just rip out OSBot's default implementation of mouse movements and replace with my own. Any advice would be awesome, just trying not to reinvent the wheel and go back to calculating / learning XY coords for everything. Makes more sense to leverage what the API already knows (coords / size of clickable areas, etc) Quote Link to comment Share on other sites More sharing options...
Medusa Posted January 21, 2020 Share Posted January 21, 2020 Make your own method using mouse.click - You would have to calculate pos etc. yourself, but that's relatively easy. Quote Link to comment Share on other sites More sharing options...
BravoTaco Posted January 21, 2020 Share Posted January 21, 2020 (edited) If you just need the position of whatever you are trying to click, and the object implements Entity, you can retrieve the bounding box of said object. Than use your mouse movement logic to move within the bounding box, than interact with it. Edited January 21, 2020 by BravoTaco Quote Link to comment Share on other sites More sharing options...
Medusa Posted January 21, 2020 Share Posted January 21, 2020 4 minutes ago, BravoTaco said: If you just need the position of whatever you are trying to click, and the object implements Entity, you can retrieve the bounding box of said object. Than use your mouse movement logic to move within the bounding box, than interact with it. Only problem with this would be that the boundingboxes sometimes are too big. public static void clickObject(MethodProvider api, RS2Object o, boolean rClick) { int x = (int) o.getModel().getBoundingBox(o.getGridX(), o.getGridY(), o.getZ()).getX(); int y = (int) o.getModel().getBoundingBox(o.getGridX(), o.getGridY(), o.getZ()).getY(); api.getMouse().click(x, y, rClick); } That will get the boundingbox of an object and click it, but if it's a ladder or some shit it will misclick a lot Quote Link to comment Share on other sites More sharing options...
BravoTaco Posted January 21, 2020 Share Posted January 21, 2020 3 hours ago, Medusa said: Only problem with this would be that the boundingboxes sometimes are too big. public static void clickObject(MethodProvider api, RS2Object o, boolean rClick) { int x = (int) o.getModel().getBoundingBox(o.getGridX(), o.getGridY(), o.getZ()).getX(); int y = (int) o.getModel().getBoundingBox(o.getGridX(), o.getGridY(), o.getZ()).getY(); api.getMouse().click(x, y, rClick); } That will get the boundingbox of an object and click it, but if it's a ladder or some shit it will misclick a lot Forgot about that. You can make the bounding box smaller after retrieving it to give a tighter area to click within. Would reduce the amount of differing positions when moving to the point but if the offset is small enough it should be ok. Quote Link to comment Share on other sites More sharing options...
Naked Posted January 21, 2020 Share Posted January 21, 2020 Pretty sure he wants to override the mouse path, not just how to instantly click it with mouse.click 12 hours ago, Medusa said: Make your own method using mouse.click - You would have to calculate pos etc. yourself, but that's relatively easy. 3 hours ago, BravoTaco said: If you just need the position of whatever you are trying to click, and the object implements Entity, you can retrieve the bounding box of said object. Than use your mouse movement logic to move within the bounding box, than interact with it. 1 Quote Link to comment Share on other sites More sharing options...
Medusa Posted January 21, 2020 Share Posted January 21, 2020 1 minute ago, Naked said: Pretty sure he wants to override the mouse path, not just how to instantly click it with mouse.click Shoo. No one wants to hear about your mouse paths. Quote Link to comment Share on other sites More sharing options...
AceKingSuited Posted January 22, 2020 Author Share Posted January 22, 2020 8 hours ago, Naked said: Pretty sure he wants to override the mouse path, not just how to instantly click it with mouse.click Yeah, overriding mouse path was exactly what I was looking for. 12 hours ago, BravoTaco said: If you just need the position of whatever you are trying to click, and the object implements Entity, you can retrieve the bounding box of said object. Than use your mouse movement logic to move within the bounding box, than interact with it. This is what I was referring to with leveraging API, awesome. 12 hours ago, Medusa said: Only problem with this would be that the boundingboxes sometimes are too big. public static void clickObject(MethodProvider api, RS2Object o, boolean rClick) { int x = (int) o.getModel().getBoundingBox(o.getGridX(), o.getGridY(), o.getZ()).getX(); int y = (int) o.getModel().getBoundingBox(o.getGridX(), o.getGridY(), o.getZ()).getY(); api.getMouse().click(x, y, rClick); } That will get the boundingbox of an object and click it, but if it's a ladder or some shit it will misclick a lot You probably just saved me a *lot* of debugging time lol, thanks 8 hours ago, Medusa said: Shoo. No one wants to hear about your mouse paths. Actually I do Quote Link to comment Share on other sites More sharing options...
ChadMcBro Posted April 26, 2020 Share Posted April 26, 2020 Hey, I was wondering how far you got on this? I don't think implementing this with some natural mouse movement libraries is all that difficult but I am hesitant on whether or not it will see any results. Quote Link to comment Share on other sites More sharing options...