vlad3921 Posted April 27, 2020 Share Posted April 27, 2020 As an example, npc.interact("Talk") does the following:: 1. Moves mouse to npc 2. Right clicks on npc 3. Moves mouse to 'Talk' option 4. Left clicks on it Steps 2 to 4 are done in extremely fast succession so I'd like to add in a little delay in between those steps to help with antiban. The same goes for other built in api methods, such as bank.depositAll() or store.buy(). Is this possible? If yes, how would you do it? Side question: How would you simulate a random mouse movement on screen? Currently, the pointer moves only if osbot was given a command which is fine, but I'd like to add some random, natural mouse movement while there is no command(event) being run. Quote Link to comment Share on other sites More sharing options...
Chris Posted April 27, 2020 Share Posted April 27, 2020 make your own using the mouse class Quote Link to comment Share on other sites More sharing options...
vlad3921 Posted April 27, 2020 Author Share Posted April 27, 2020 (edited) Thanks, that's what I thought. What's the API that deals with the menu that opens up when you right click on an object such as npc or chest? I managed to get as far as right clicking on my object, but now I'm not sure how to choose the option I want from the popup. Edited April 27, 2020 by vlad3921 Quote Link to comment Share on other sites More sharing options...
Kramnik Posted April 28, 2020 Share Posted April 28, 2020 Wait for new mouse algo, we should be able to control mouse speed Quote Link to comment Share on other sites More sharing options...
BravoTaco Posted April 29, 2020 Share Posted April 29, 2020 This will right click an entity and click the action. You can add sleeps wherever you would like. You can also add offsets to the mouse position so that it is more randomized. private boolean customRightClickInteract(Entity entity, String interaction) throws InterruptedException { if (entity != null && entity.hover()) { // Right clicks the entity. getMouse().click(true); // This creates a temporary actionOption to later hold the actual option. Option actionOption = null; // This loops through all the active options on the screen and checks to see if // any match the interaction string. // It also increases the index so that it can later be used to grab the correct // rectangle from the option. int index = 0; for (Option option : getMenuAPI().getMenu()) { if (option.action.toLowerCase().equalsIgnoreCase(interaction.toLowerCase())) { actionOption = option; break; } index++; } if (actionOption != null) { // Moves the mouse to the designated action. You should probably give offsets // to the rec.getCenterX() and the rec.getCenterY() so that it doesn't always // go to the center of the text. The y will only be able to have an offset // of around -3 - 3 or so. // The x should be able to handle more maybe -15 - 15? You will have to // mess around with it. Rectangle rec = getMenuAPI().getOptionRectangle(index); getMouse().move((int) rec.getCenterX(), (int) rec.getCenterY()); return getMouse().click(false); } } return false; } Quote Link to comment Share on other sites More sharing options...