Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Mouse trail and cursor classes

Featured Replies

3 classes u can use to add a trail and a crusor

Classes:

Spoiler

MousePathPoint.java:


package Utils;

import java.awt.Point;

public class MousePathPoint extends Point{
	
	private long finishTime;

	public MousePathPoint(int x, int y, int lastingTime){
		super(x,y);
		finishTime= System.currentTimeMillis() + lastingTime;
	}
	
	public boolean isUp(){
		return System.currentTimeMillis() > finishTime;
	}
}

MouseTrail.java:


package Utils;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Point;
import java.util.LinkedList;

import org.osbot.rs07.script.MethodProvider;

public class MouseTrail {

	private int r, g, b, duration;
	private LinkedList<MousePathPoint> mousePath  = new LinkedList<MousePathPoint>();;
	private MethodProvider api;


	public MouseTrail(int r, int g, int b, int duration, MethodProvider api) {
		this.r = r;
		this.g = g;
		this.b = b;
		this.duration = duration;
		this.api = api;
	}
	
	public void nextRGB(){
		if(r == 255 && g < 255 & b == 0){
			g++;
		}
        if ( g == 255 && r > 0 && b == 0 )
        {
            r--;
        }
        if ( g == 255 && b < 255 && r == 0 )
        {
            b++;
        }
        if ( b == 255 && g > 0 && r == 0 )
        {
            g--;
        }
        if ( b == 255 && r < 255 && g == 0 )
        {
            r++;
        }
        if ( r == 255 && b > 0 && g == 0 )
        {
            b--;
        }
        
	}
	

	public Color nextColor(){
		nextRGB();
		return new Color(r,g,b);
	}

	public void paint(Graphics2D g){
		while (!mousePath.isEmpty() && mousePath.peek().isUp())
            mousePath.remove();
        Point clientCursor = api.getMouse().getPosition();
        MousePathPoint mpp = new MousePathPoint(clientCursor.x, clientCursor.y, duration);
        if (mousePath.isEmpty() || !mousePath.getLast().equals(mpp))
            mousePath.add(mpp);
        MousePathPoint lastPoint = null;
        for (MousePathPoint a : mousePath) {
            if (lastPoint != null) {
                g.setColor(nextColor());
                g.drawLine(a.x, a.y, lastPoint.x, lastPoint.y);
            }
            lastPoint = a;
        }
	}
	
}

MouseCursor.java:


package Utils;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.awt.geom.Arc2D;

import org.osbot.rs07.script.MethodProvider;

public class MouseCursor {

	private int mX, mY;
	private int size;
	private long angle;
	private BasicStroke cursorStroke;
	private Color cursorColor;
	private AffineTransform oldTransform;
	private MethodProvider api;

	public MouseCursor(int size, int thickness, Color color, MethodProvider api) {
		this.size = size;
		this.cursorStroke = new BasicStroke(thickness);
		this.cursorColor = color;
		this.api = api;
	}

	public void paint(Graphics2D g) {
		oldTransform = g.getTransform();
		mX = api.getMouse().getPosition().x;
		mY = api.getMouse().getPosition().y;

		if (mX != -1) {
			g.setStroke(cursorStroke);
			g.setColor(cursorColor);
			g.drawLine(mX - (size / 8), mY - (size / 8), mX + (size / 12), mY + (size / 12));
			g.drawLine(mX - (size / 8), mY + (size / 12), mX + (size / 12), mY - (size / 8));

			g.rotate(Math.toRadians(angle += 6), mX, mY);

			g.draw(new Arc2D.Double(mX - (size / 2), mY - (size / 2), size, size, 330, 60, Arc2D.OPEN));
			g.draw(new Arc2D.Double(mX - (size / 2), mY - (size / 2), size, size, 151, 60, Arc2D.OPEN));

			g.setTransform(oldTransform);
		}
	}

}

 

Usage:

global vars:

private MouseTrail trail = new MouseTrail(0, 255, 255, 2000, this);
private MouseCursor cursor = new MouseCursor(52, 4, Color.white, this);

onPaint:

public void onPaint(Graphics2D g){
	trail.paint(g);
	cursor.paint(g);
}

 

Credit:

swizzbeat -> cursor

DarkMagican -> trail

Original posts:

 

 

 

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.