Bot Tom Frag 2 Share Posted December 31, 2017 I was not sure if the getMouse().move(java.awt.Rectangle rectangle) moved to the specified rectangle in the way I wanted, so instead I made an awesome class that I think may help a lot with anti ban.The theory: A lot of human actions and observations by humans tend to be normally distributed. (in layman's terms: humans tend to aim for the middle of something and have a chance of making mistakes around that middle point. The further the point is from the middle, the less chance of clicking that point) So I made a class called MouseArea (that works much like DreamBot's Area class), which is a java.awt.Rectangle behind the scenes, and stores a screen area. The real magic is the getRandomGaussianPoint(), which returns a a gaussian distributed point. An illustration of a bunch of points being generated: Or with getRandomGaussianPoint(true) which forces points to be within the MouseArea: It also supports uniform (every point has equal probability) points: Usage:I had a button ingame that I wanted to press but the widget was slightly misaligned. Since we always run in fixed mode I set the MouseArea coordinates of the area I wanted to click in, but I didn't want it to be too random (uniform) as that would look weird. Instead I used a gaussian point distribution. I could've also not forced the generated points to be inside the button, so that 0.3% of my clicks would be a misclick. MouseArea Code: *it may look like a lot of code but it is actually very light weight and only a few lines. The javadocs make it seem bigger. import java.awt.Point; import java.awt.Rectangle; import java.util.Random; /** * Represents an area on the screen. * <br> * Specifically designed for use in DreamBot API. Follows DreamBot API standards. * @[member='Authorities'] Bot Tom Frag (DreamBot) * */ public class MouseArea extends Rectangle{ private Random r; /** * Create a new MouseArea by defining its top left coordinate pairs, followed by its bottom right coordinate pairs. * @[member='param'] x1 : bounding rectangle top left x coordinate * @[member='param'] y1 : bounding rectangle top left y coordinate * @[member='param'] x2 : bounding rectangle bottom right x coordinate * @[member='param'] y2 : bounding rectangle bottom right y coordinate */ public MouseArea(int x1, int y1, int x2, int y2){ super(x1,y1,Math.abs(x1-x2),Math.abs(y1-y2)); r = new Random(); } /** * Create a new MouseArea by defining its top left coordinate (java.awt.Point), followed by its bottom right coordinate (java.awt.Point) * @[member='param'] topleft : bounding rectangle top left coordinate as java.awt.Point * @[member='param'] bottomright : bounding rectangle bottom right coordinate as java.awt.Point */ public MouseArea(Point topleft, Point bottomright){ super(topleft.x,topleft.y,Math.abs(topleft.x-bottomright.x),Math.abs(topleft.y-bottomright.y)); r = new Random(); } /** * Returns a uniformly distributed point that lies within the MouseArea (each point in the MouseArea has an equal chance of occurring) * @[member='Return'] Point : a java.awt.Point that lies randomly(uniform) within the MouseArea */ public Point getRandomPoint(){ return new Point(x + r.nextInt(width+1), y + r.nextInt(height+1)); } /** * Returns a normally distributed point around the center of the MouseArea and with standard deviation of width/6 and height/6, resulting in 99.7% probability of being within the MouseArea. (points closer to the center are more likely than points closer to the edge) * <br> * <b>Warning:</b> Points may lie outside of the MouseArea (0.3% chance). If you would like to guarantee points are inside, see {@[member='Link'] #getRandomGaussianPoint(boolean)} * * @[member='Return'] Point : a java.awt.Point that is normally distributed around the center */ public Point getRandomGaussianPoint(){ return new Point( (int)(getCenterX() + r.nextGaussian()*width/6), (int)(getCenterY() + r.nextGaussian()*height/6) ); } /** * Returns a normally distributed point around the center of the MouseArea and with standard deviation of width/6 and height/6, resulting in 99.7% probability of being within the MouseArea. (points closer to the center are more likely than points closer to the edge) * <br> * Setting boolean forceInside to true will force points to lie within the MouseArea (may require slightly extra computation) * <br> * <b>Warning:</b> Points may lie outside of the MouseArea (0.3% chance) <b>IF</b> forceInside is set to false. * * see also {@[member='Link'] #getRandomGaussianPoint()} * * @[member='param'] forceInside : boolean that forces the point generated to be inside * @[member='Return'] */ public Point getRandomGaussianPoint(boolean forceInside){ Point p = new Point( (int)(getCenterX() + r.nextGaussian()*width/6), (int)(getCenterY() + r.nextGaussian()*height/6) ); if(forceInside) while(!this.contains(p)) p = new Point( (int)(getCenterX() + r.nextGaussian()*width/6), (int)(getCenterY() + r.nextGaussian()*height/6) ); return p; } } Side note:This is my first post, thought I'd share any cool stuff I thought of while developing my first few bots. Also loving the API and client! So much better than other clients I have tried to make bots on. Also here's the code used to test if you want to play around: http://www.filedropper.com/mouseareatester Link to comment Share on other sites More sharing options...
dQw4w9WgXcQ 184 Share Posted December 31, 2017 i think the client already does this. Link to comment Share on other sites More sharing options...
Bot Tom Frag 2 Author Share Posted December 31, 2017 i think the client already does this. Ah, well if it does then that's good. I just wasn't sure as the javadocs don't specify and I couldn't find a post on it. At least now I can define custom distributions and other things that make me unique as a botter I guess. Question: does the client do misclicks (and correction of misclicks) occasionally? I know that when I'm afking/half paying attention that I sometimes miss a click and have to reclick. Link to comment Share on other sites More sharing options...
Articron 738 Share Posted December 31, 2017 Ah, well if it does then that's good. I just wasn't sure as the javadocs don't specify and I couldn't find a post on it. At least now I can define custom distributions and other things that make me unique as a botter I guess. Question: does the client do misclicks (and correction of misclicks) occasionally? I know that when I'm afking/half paying attention that I sometimes miss a click and have to reclick. It certainly does missclick, this is why interactions in general have a boolean return type for the scripter to know if it was a missclick or not Link to comment Share on other sites More sharing options...
cammofunk 2 Share Posted March 30, 2018 Still awesome stuff! I like the visual Link to comment Share on other sites More sharing options...
RoboMan 1 Share Posted October 4, 2018 On 12/31/2017 at 12:30 AM, Bot Tom Frag said: The theory: A lot of human actions and observations by humans tend to be normally distributed. (in layman's terms: humans tend to aim for the middle of something and have a chance of making mistakes around that middle point. The further the point is from the middle, the less chance of clicking that point) I would like to disagree with this theory. This would make sense on a mobile phone or tablet, where no "drag" is necessary. But if you look at actual heatmaps from players dragging mice, they often overshoot in the direction that they are coming from, rather then evenly distribute points like you've shown above. Link to comment Share on other sites More sharing options...
RoboMan 1 Share Posted October 4, 2018 Here is a good example. Consider more in-line variability than even distribution. The links at the tops have more misses above the button than below, because a user is dragging from below Link to comment Share on other sites More sharing options...
Bot Tom Frag 2 Author Share Posted February 1, 2020 On 10/4/2018 at 1:32 PM, RoboMan said: Here is a good example. Consider more in-line variability than even distribution. The links at the tops have more misses above the button than below, because a user is dragging from below Years later, but I just saw this and couldn't agree more. I actually ended up making something similar to this where the points were normally distributed in the axis perpendicular to the mouse's path to its target, but were gamma-distributed (favouring overshoot) on the axis of movement. It ended up working really well. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.