Jump to content
dokato

mouse to option

Recommended Posts

So I want my mouse to move to a entity, right click on it and then move to an option from the "Choose option" menu but not click on it.

I already have this for example:

 

Entity door = objects.closest("Door");

EntityDestination mouseDoor = new EntityDestination(getBot(),door);

 

getMouse().click(mouseChest, true); 

 

now the mouse just moves to the door and right clicks on it. But what should i add to make it even move to the "Open" action but not click on it yet?

Link to comment
Share on other sites

Umm maybe something along the lines of this:

(Not sure if it works but the logic is there and could be tweaked)

void hovenEntityOption(Entity entity, String option){
        if(menu.isOpen() && menuContains(option)){
         Rectangle optionBox = menu.getOptionRectangle(menuIndex(option));
            if(optionBox != null){
                if(optionBox.contains(mouse.getPosition())){
                    //idling
                }else{
                    int x,y;
                    do {
                        x = (int) (optionBox.getX() + optionBox.getWidth() * Math.random());
                        y = (int) (optionBox.getY() + optionBox.getHeight() * Math.random());
                    } while(!optionBox.contains(x,y)) ;
                    mouse.move(x,y);
                }
            }
        }else{
            if(menu.isOpen() && !menuContains(option)){
                menu.selectAction("Cancel");
            }else {
                if (entity.hover()) {
                    mouse.click(false);
                }
            }
        }
    }
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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