Jump to content

Force a right click for an interaction


Molly

Recommended Posts

I've been working on some antiban for my scripts where based upon a seed the likelihood of right/left clicking for an interaction varies, this is so user's behavior will vary per account.  I've run into a problem however, I cannot figure out how to force a right click when say, interacting with an item in the inventory or an object. 

 

I know I can move the mouse to the object, item, etc, that's simple of course. I also know I can use the method mouse.click(true) to right click when at the destination.  The problem is if I move the mouse to the item, right click, then do:

myItem.interact("Use");

The bot will not simply select "Use" from the already open menu(opened via the right click earlier) but rather it will move the mouse, then go back to the item and left click to select "Use", assuming "Use" is the first option available. I had hoped using the mouse.click(true) method would be a good work around since apparently interact(action, boolean rightClick) is not a thing(I swear it used to be?), and InteractionEvent doesn't offer a force right click option.

Can anyone help me with this problem? I would be very grateful! Thanks.

Edited by Molly
Link to comment
Share on other sites

I've been working on some antiban for my scripts where based upon a seed the likelihood of right/left clicking for an interaction varies, this is so user's behavior will vary per account.  I've run into a problem however, I cannot figure out how to force a right click when say, interacting with an item in the inventory or an object. 

 

I know I can move the mouse to the object, item, etc, that's simple of course. I also know I can use the method mouse.click(true) to right click when at the destination.  The problem is if I move the mouse to the item, right click, then do:

myItem.interact("Use");

The bot will not simply select "Use" from the already open menu(opened via the right click earlier) but rather it will move the mouse, then go back to the item and left click to select "Use", assuming "Use" is the first option available. I had hoped using the mouse.click(true) method would be a good work around since apparently interact(action, boolean rightClick) is not a thing(I swear it used to be?), and InteractionEvent doesn't offer a force right click option.

Can anyone help me with this problem? I would be very grateful! Thanks.

if u did right click u can use:

if(menu.isOpen()){
  menu.selectAction(Action Here);
}

Or i didnt understand u if this is what u need.

 

Thanks,

Progamerz

Edited by progamerz
  • Like 2
Link to comment
Share on other sites

I've been working on some antiban for my scripts where based upon a seed the likelihood of right/left clicking for an interaction varies, this is so user's behavior will vary per account.  I've run into a problem however, I cannot figure out how to force a right click when say, interacting with an item in the inventory or an object. 

 

I know I can move the mouse to the object, item, etc, that's simple of course. I also know I can use the method mouse.click(true) to right click when at the destination.  The problem is if I move the mouse to the item, right click, then do:

myItem.interact("Use");

The bot will not simply select "Use" from the already open menu(opened via the right click earlier) but rather it will move the mouse, then go back to the item and left click to select "Use", assuming "Use" is the first option available. I had hoped using the mouse.click(true) method would be a good work around since apparently interact(action, boolean rightClick) is not a thing(I swear it used to be?), and InteractionEvent doesn't offer a force right click option.

Can anyone help me with this problem? I would be very grateful! Thanks.

interact(action, boolean rightClick)

was removed. Try getting the items location and creating a custom method using the Mouse class & MenuAPI class

then just mouse click and check if the correct item is selected.

  • Like 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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