Jump to content

Overriding Interact Mouse Movement


Recommended Posts

Posted

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)

Posted
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

Posted
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.

Posted

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.

 

  • Like 1
Posted
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 😭

  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...