Ragnar Lothbrok Posted October 31, 2018 Posted October 31, 2018 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!
ScummyBotter Posted October 31, 2018 Posted October 31, 2018 (edited) 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, 2018 by ScummyBotter
Ragnar Lothbrok Posted October 31, 2018 Author Posted October 31, 2018 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
Ragnar Lothbrok Posted October 31, 2018 Author Posted October 31, 2018 Might have a solution - testing it just now
HunterRS Posted October 31, 2018 Posted October 31, 2018 Have you tried a WalkingEvent with event.setMinDistanceThreshold(0)?
Ragnar Lothbrok Posted October 31, 2018 Author Posted October 31, 2018 6 minutes ago, HunterRS said: Have you tried a WalkingEvent with event.setMinDistanceThreshold(0)? Did you even read the thread?
FrostBug Posted October 31, 2018 Posted October 31, 2018 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
Ragnar Lothbrok Posted October 31, 2018 Author Posted October 31, 2018 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.
HunterRS Posted October 31, 2018 Posted October 31, 2018 (edited) 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, 2018 by HunterRS
Ragnar Lothbrok Posted October 31, 2018 Author Posted October 31, 2018 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.
Antonio Kala Posted October 31, 2018 Posted October 31, 2018 Try walking to an area instead of a position and have the area be only one tile and see if it miss-clicks.
Juggles Posted October 31, 2018 Posted October 31, 2018 (edited) 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, 2018 by Juggles 1
Ragnar Lothbrok Posted November 1, 2018 Author Posted November 1, 2018 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?
Juggles Posted November 1, 2018 Posted November 1, 2018 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.