Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
    • Best Sellers

    • Latest Products

    • Featured

    • Topics

    • Posts

      • Nothing was changed from when i was on last night so i am confused
      • Upated to use Perlin noise to generate control points, plenty of variables to adjust, have fun   import org.dreambot.api.input.Mouse; import org.dreambot.api.input.event.impl.mouse.MouseButton; import org.dreambot.api.input.mouse.algorithm.MouseAlgorithm; import org.dreambot.api.input.mouse.destination.AbstractMouseDestination; import org.dreambot.api.methods.Calculations; import org.dreambot.api.utilities.Logger; import java.awt.*; import java.util.Random; /** * Open source Mouse Algorithm using Kochanek-Bartels splines */ public class KochanekBartelsMouse implements MouseAlgorithm { private final double tension; private final double bias; private final double continuity; private Random random = new Random(); public KochanekBartelsMouse(double tension, double bias, double continuity) { this.tension = tension; this.bias = bias; this.continuity = continuity; } @Override public boolean handleMovement(AbstractMouseDestination abstractMouseDestination) { Point suitPos = abstractMouseDestination.getSuitablePoint(); mouseMovement(suitPos); return distance(Mouse.getPosition(), suitPos) < 2; } @Override public boolean handleClick(MouseButton mouseButton) { return Mouse.getDefaultMouseAlgorithm().handleClick(mouseButton); } public static void sleep(int min, int max) { try { Thread.sleep(Calculations.random(min, max)); } catch (InterruptedException e) { Logger.log(e.getMessage()); } } public static void sleep(int ms) { try { Thread.sleep(ms); } catch (InterruptedException e) { Logger.log(e.getMessage()); } } /** * Enhanced mouse movement using Kochanek Bartels splines * * @param point The destination point */ public void mouseMovement(Point point) { Point curPos = Mouse.getPosition(); moveMouseSpline(curPos, point); // Directly move to the target point } /** * Generate control points for Kochanek Bartels spline * * @param start The start point * @param end The end point * @return Array of control points */ private Point[] generateControlPoints(Point start, Point end) { Point[] controlPoints = new Point[4]; controlPoints[0] = start; controlPoints[3] = end; double distance = distance(start, end); int maxOffset = (int) (distance / 4); // adjust this to control the curve complexity int midX = (start.x + end.x) / 2; int midY = (start.y + end.y) / 2; // Using Perlin noise to create more complex control points double noise1 = perlinNoise(random.nextDouble(), random.nextDouble()); double noise2 = perlinNoise(random.nextDouble(), random.nextDouble()); double angle = Math.atan2(end.y - start.y, end.x - start.x); double offsetAngle = Math.PI / 10; // adjust this angle for different curve shapes controlPoints[1] = new Point(midX + (int) (Math.cos(angle - offsetAngle) * maxOffset + noise1 * maxOffset), midY + (int) (Math.sin(angle - offsetAngle) * maxOffset + noise1 * maxOffset)); controlPoints[2] = new Point(midX + (int) (Math.cos(angle + offsetAngle) * maxOffset + noise2 * maxOffset), midY + (int) (Math.sin(angle + offsetAngle) * maxOffset + noise2 * maxOffset)); return controlPoints; } /** * Move mouse using a Kochanek Bartels spline * * @param start The start point * @param end The end point */ private void moveMouseSpline(Point start, Point end) { Point[] controlPoints = generateControlPoints(start, end); int steps = Calculations.random(50, 100); // Increase steps for smoother curves for (int i = 0; i <= steps; i++) { double t = (double) i / (double) steps; Point p = kochanekBartelsSpline(controlPoints, t); Mouse.hop(p); try { Thread.sleep(Calculations.random(5, 15)); } catch (InterruptedException e) { Logger.log(e.getMessage()); } } } /** * Calculate a point on a Kochanek Bartels spline * * @param points The control points * @param t The parameter t (0 <= t <= 1) * @return The point on the spline at parameter t */ private Point kochanekBartelsSpline(Point[] points, double t) { double t2 = t * t; double t3 = t2 * t; double h1 = 2 * t3 - 3 * t2 + 1; double h2 = -2 * t3 + 3 * t2; double h3 = t3 - 2 * t2 + t; double h4 = t3 - t2; Point p0 = points[0]; Point p1 = points[3]; Point p2 = points[1]; Point p3 = points[2]; double m0x = (1 - tension) * (1 + bias) * (1 + continuity) * (p2.x - p0.x) / 2 + (1 - tension) * (1 - bias) * (1 - continuity) * (p3.x - p1.x) / 2; double m0y = (1 - tension) * (1 + bias) * (1 + continuity) * (p2.y - p0.y) / 2 + (1 - tension) * (1 - bias) * (1 - continuity) * (p3.y - p1.y) / 2; double m1x = (1 - tension) * (1 - bias) * (1 + continuity) * (p3.x - p1.x) / 2 + (1 - tension) * (1 + bias) * (1 - continuity) * (p3.x - p2.x) / 2; double m1y = (1 - tension) * (1 - bias) * (1 + continuity) * (p3.y - p1.y) / 2 + (1 - tension) * (1 + bias) * (1 - continuity) * (p3.y - p2.y) / 2; int x = (int) (h1 * p0.x + h2 * p1.x + h3 * m0x + h4 * m1x); int y = (int) (h1 * p0.y + h2 * p1.y + h3 * m0y + h4 * m1y); return new Point(x, y); } /** * Simple Perlin noise implementation * * @param x The x coordinate * @param y The y coordinate * @return The Perlin noise value */ private double perlinNoise(double x, double y) { return Math.sin(2 * Math.PI * x) * Math.cos(2 * Math.PI * y); } public double distance(Point p1, Point p2) { return Math.sqrt((p2.y - p1.y) * (p2.y - p1.y) + (p2.x - p1.x) * (p2.x - p1.x)); } }
      • Does this also disable the use of teleports in the magic tab?
      • WebFinder webFinder = WebFinder.getWebFinder(); webFinder.disableInventoryTeleports(); webFinder.disableEquipmentTeleports(); webFinder.disableEquippingTeleports();
      • Mouse.setMouseAlgorithm(new KochanekBartelsMouse(5,0,0.1)); don't forget to add this line in your onStart() method and play around with the 3 argument - tension, bias & continuity enjoy this algorithm that should be free to all
    • Popular Contributors

    • Feedback Statistics

      • Positive
        11388
      • Neutral
        18
      • Negative
        144
      • Total Positive
        99%
    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.