Jump to content

Overriding Interact Mouse Movement


AceKingSuited

Recommended Posts

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)

Link to comment
Share on other sites

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 by BravoTaco
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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 😭

Link to comment
Share on other sites

  • 3 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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