Skip 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.

BotMouseListener: checkMouseEvent. Trying to register mouse events.

Featured Replies

I'm lost on how this part of the API works. I'm trying to do something on the following triggers:

- Mouse down;
- Mouse movement (can be done with getMouse().getPosition(); maybe there's a better way?;
- Mouse up;
- Mouse click (?); might be the combination of mouse down and up;
- Mouse drag (?); might be the combination of mouse down and mouse movement.

Now, I have found the BotMouseListener and the checkMouseEvent which seems promising, but I have not a single clue how to implement it. A push in the right direction or some code snippets would be greatly appreciated!

BotMouseListener is a class than can be used to record your mouse clicks. In order to recreate them, use the ClientMouseEventHandler

import org.osbot.rs07.input.mouse.BotMouseListener;
import org.osbot.rs07.script.Script;

import java.awt.event.MouseEvent;

public class MouseHandler extends Script {

    private final BotMouseListener mouseListener = new BotMouseListener() {
        @Override
        public void checkMouseEvent(MouseEvent mouseEvent) {
            // called when you click the canvas
        }
    };

    @Override
    public void onStart() {
        getBot().addMouseListener(mouseListener);
    }

    @Override
    public int onLoop() throws InterruptedException {
        // generate a mouse event
        getBot().getMouseEventHandler().generateBotMouseEvent(...);
        return 1000;
    }

    @Override
    public void onExit() throws InterruptedException {
        getBot().removeMouseListener(mouseListener);
    }
}

https://osbot.org/api/org/osbot/rs07/input/mouse/ClientMouseEventHandler.html

  • Author
20 hours ago, Camaro said:

BotMouseListener is a class than can be used to record your mouse clicks. In order to recreate them, use the ClientMouseEventHandler


import org.osbot.rs07.input.mouse.BotMouseListener;
import org.osbot.rs07.script.Script;

import java.awt.event.MouseEvent;

public class MouseHandler extends Script {

    private final BotMouseListener mouseListener = new BotMouseListener() {
        @Override
        public void checkMouseEvent(MouseEvent mouseEvent) {
            // called when you click the canvas
        }
    };

    @Override
    public void onStart() {
        getBot().addMouseListener(mouseListener);
    }

    @Override
    public int onLoop() throws InterruptedException {
        // generate a mouse event
        getBot().getMouseEventHandler().generateBotMouseEvent(...);
        return 1000;
    }

    @Override
    public void onExit() throws InterruptedException {
        getBot().removeMouseListener(mouseListener);
    }
}

https://osbot.org/api/org/osbot/rs07/input/mouse/ClientMouseEventHandler.html

Thank you so much, works like a charm.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.