October 31, 20187 yr Is there a way I can verify that the mouse is in fact on the specified position? I need to walk to specific tiles however I'm having troubles with the bot missclicking. Have tried walking events with mini-map threshold and distance threshold set as well as position.hover then click but this still has problems. Current code for walking to a position: if (!position.isVisible(api.getBot())) { api.getCamera().toPosition(position); } else { if (position.hover(api.getBot())) { if (api.getMouse().click(false)) { Sleep.sleepUntil(() -> inPosition(position) && !api.myPlayer().isMoving(), 5000); } } } Have also tried: WalkingEvent walkingEvent = new WalkingEvent(position); walkingEvent.setMinDistanceThreshold(0); walkingEvent.setMiniMapDistanceThreshold(10); api.execute(walkingEvent); Sleep.sleepUntil(() -> inPosition(position) && !api.myPlayer().isMoving(), 5000); Appreciate any help!
October 31, 20187 yr I had the same problem, position.hover then click seemed to work for me, the thing is if you are moving and it's already hovered over a position it wont keep on hovering, the players movement will offset the hover, so I had to re-hover before I clicked to make sure, that worked good enough for me. I wouldn't be surprised if there's a better solution though. Edited October 31, 20187 yr by ScummyBotter
October 31, 20187 yr Author Just now, ScummyBotter said: I had the same problem, position.hover then click seemed to work for me, the thing is if you are moving and it's already hovered over a position it wont keep on hovering, the players movement will offset the hover, so I had to re-hover before I clicked to make sure, that worked good enough for me I've tried checking to make sure my player isn't moving before clicking however I'm still having troubles with the wrong tiles being clicked
October 31, 20187 yr Author 6 minutes ago, HunterRS said: Have you tried a WalkingEvent with event.setMinDistanceThreshold(0)? Did you even read the thread?
October 31, 20187 yr What results are you getting with WalkingEvent? From what I understand it should retry until at the desired location or reach an attempt threshold. Also it's a blocking event, so sleeping after the fact probably won't do anything
October 31, 20187 yr Author Just now, FrostBug said: What results are you getting with WalkingEvent? From what I understand it should retry until at the desired location or reach an attempt threshold. Also it's a blocking event, so sleeping after the fact probably won't do anything With the walking event sometimes the correct tile is clicked - other times the tiles next to the correct tile is clicked.
October 31, 20187 yr 11 minutes ago, Ragnar Lothbrok said: Did you even read the thread? I meant just with that, I have the following on my sandcrabs script and it works everytime. (Credit not to me, don't remember where I got it it was a long time ago) private static boolean walkExact(Script script, Position position) { WalkingEvent event = new WalkingEvent(position); event.setMinDistanceThreshold(0); return script.execute(event).hasFinished(); } Sorry for no codeblock, don't know how to do it on mobile. EDIT: To be clear, I call that function over and over again until the player reached the position. Edited October 31, 20187 yr by HunterRS
October 31, 20187 yr Author 1 minute ago, HunterRS said: I meant just with that, I have the following on my sandcrabs script and it works everytime. (Credit not to me, don't remember where I got it it was a long time ago) private static boolean walkExact(Script script, Position position) { WalkingEvent event = new WalkingEvent(position); event.setMinDistanceThreshold(0); return script.execute(event).hasFinished(); } Sorry for no codeblock, don't know how to do it on mobile. Eventually that will walk to the exact tile yes - but I can't afford miss-clicks in this script.
October 31, 20187 yr Try walking to an area instead of a position and have the area be only one tile and see if it miss-clicks.
October 31, 20187 yr You can't control misclicks. Every script will evntually misclick due to ping, lag and the client isn't 100% efficient. No matter what the click could misclick. But the next click will fix it. Same as a human. A human will misclick every once in a while Edited October 31, 20187 yr by Juggles
November 1, 20187 yr Author 16 hours ago, Juggles said: You can't control misclicks. Every script will evntually misclick due to ping, lag and the client isn't 100% efficient. No matter what the click could misclick. But the next click will fix it. Same as a human. A human will misclick every once in a while A method to verify the mouse hover position could work - just have the bot pause until true then we know for sure we're clicking on the correct position?
November 1, 20187 yr 6 hours ago, Ragnar Lothbrok said: A method to verify the mouse hover position could work - just have the bot pause until true then we know for sure we're clicking on the correct position? Sure do if (mouse.isHovering) { mouse.click(false); } else { mouse.hover } But the mouse could still spaz out randomly sometimes.
Create an account or sign in to comment