Im A Baller 348 Share Posted December 13, 2016 I'm working on a rooftop agility script, and tbh, it basically works perfectly (I've had like a full day to work on it lol), but one thing that I can't find a fix for is the inaccurate clicks of the mouse on smaller objects. Sometimes the interaction returns a true value, in spite of not properly clicking on the object as well (already tried checking for that). if(utils.interact(nextObstacle)) { MethodContext.sleepUntil(new Condition() { @Override public boolean verify() { return m.getLocalPlayer().isAnimating(); } }, 2500); } The interact method in my utils: public boolean interact(Entity e, String... action) { InteractionEvent ie = new InteractionEvent(new EntityDestination(m.getClient(), e)); if(action.length > 0) { return ie.interact(action[0]); } return ie.interact(); } It will end up misclicking often enough that it becomes a problem, and each time it misclicks, it needs to sit there for 3.5 sec until the conditioned sleep runs its course. Edit: Occasionally, it will also simply hover over the object and move the mouse by just a few pixels every other second for ~ 20 seconds before actually clicking the object. An exception that I received twice out of ~ 40 runs (looks like it goes back to the actual method closest() in GameObjects): [ERROR]20:24:23: Exception has occurred while running! Please report error to developer if problem persists: java.util.ConcurrentModificationException at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1380) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502) at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) at org.dreambot.api.methods.interactive.GameObjects.all(GameObjects.java:65) at org.dreambot.api.methods.interactive.Interactables.all(Interactables.java:59) at org.dreambot.api.methods.interactive.Interactables.closest(Interactables.java:103) at nodes.Course.correctObstacle(Course.java:83) //code at this point shown below at nodes.Course.execute(Course.java:42) at main.Main.onLoop(Main.java:57) at org.dreambot.api.script.AbstractScript.run(AbstractScript.java:239) at java.lang.Thread.run(Thread.java:745) //this is the method that gives me the above exception ^ return m.getGameObjects().closest(new Filter<GameObject>() { @Override public boolean match(GameObject o) { return o != null && o.getName().equals(ao.getName()) && o.getTile().equals(ao.getTile()); } }); I've already come up with a ghetto fix to this that makes it wait for a bit less, but I don't like it, and I'd enjoy hearing input from people with more experience with the Dreambot API Edit 2: Still looking for an answer.... I plan on publicly releasing this script. The script runs perfectly aside from this issue, but it still needs to be fixed, and some input would really be appreciated... Link to comment Share on other sites More sharing options...
Dezval 44 Share Posted December 13, 2016 if(getGameObject.closest(GameObject).interact()){ sleepUntil(()->whatever you're waiting for, xTime)}and keep it in a loop until it interacts. Link to comment Share on other sites More sharing options...
Im A Baller 348 Author Share Posted December 13, 2016 if(getGameObject.closest(GameObject).interact()){ sleepUntil(()->whatever you're waiting for, xTime) } and keep it in a loop until it interacts. that seems like a very dangerous method. regardless, it often returns a value of 'true' even if it doesnt properly interact Link to comment Share on other sites More sharing options...
Dezval 44 Share Posted December 13, 2016 Or you can try and get the centerpoint of the game object, and offset it randomly by a tiny bit to make it a little non bot-like. Link to comment Share on other sites More sharing options...
Im A Baller 348 Author Share Posted December 13, 2016 Or you can try and get the centerpoint of the game object, and offset it randomly by a tiny bit to make it a little non bot-like. good idea - i'm going to try and see what i can do with this. Link to comment Share on other sites More sharing options...
Cardozz 46 Share Posted December 15, 2016 Or you can try and get the centerpoint of the game object, and offset it randomly by a tiny bit to make it a little non bot-like. good idea - i'm going to try and see what i can do with this. Or maybe even BETTER: why not just let it missclick? That's what humans do, especially on small hitboxes Link to comment Share on other sites More sharing options...
Im A Baller 348 Author Share Posted December 15, 2016 Or maybe even BETTER: why not just let it missclick? That's what humans do, especially on small hitboxes because the misclick looks very inhuman based upon its location. the interaction method returns 'true' if its clicked on anything (doesn't necessarily have to be the object), so if i use a conditional sleep to check if my player is animating, it waits for the whole conditional sleep unnecessarily Link to comment Share on other sites More sharing options...
Dezval 44 Share Posted December 16, 2016 good idea - i'm going to try and see what i can do with this. Message me if you need help with this Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.