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.

[Snippet] ConcurrentMouseAPI; schedule mouse tasks to run one after the other

Featured Replies

Source: https://github.com/Bobrocket/ConcurrentMouseAPI

 

ConcurrentMouseAPI allows you to move the mouse in a different way to the default OSBot API.

How?

 

The MouseScheduler class will spawn a new thread, which, when mouse targets are scheduled, will simply execute them one after the other in order of their priority. IMMEDIATE tasks run first, and LOWEST tasks run, well, last.

 

Example usage:

scheduler.schedule(new RectangleMouseTarget(new Rectangle(200, 200, 20, 20), MousePriority.NORMAL, MouseTarget.MOUSE_NO_CLICK)); //Despite being scheduled first, this will be ran second (after the IMMEDIATE task)
scheduler.schedule(new RectangleMouseTarget(new Rectangle(500, 500, 20, 20), MousePriority.LOWEST, MouseTarget.MOUSE_NO_CLICK)); //Despite being scheduled second, this will be ran last
scheduler.schedule(new NPCMouseTarget("Banker tutor", MousePriority.IMMEDIATE, MouseTarget.MOUSE_NO_CLICK)); //Despite being scheduled last, this will be ran first

You can also check the Main.java class in the github link (REMEMBER TO REMOVE IT BEFORE WRITING CODE)

 

This is incredibly useful for stuff like prayer flicking, 3 tick fishing, and inventory management. In the case of prayer flicking, you might have a separate thread to move the mouse every ~500ms. This might clash with your main logic, for example your NPC attacking or potion drinking.

Using ConcurrentMouseAPI, you can simply create prayer flicking as an IMMEDIATE task, therefore it's executed first. Clean prayer flicking with little code and no clashing!

 

NOTE: Methods which use the default mouse API (such as NPC#interact()) will not use ConcurrentMouseAPI and thus may affect the performance of it. If you want to correctly and properly utilise ConcurrentMouseAPI, convert all of your #interacts to MouseTargets and you're good to go.

Edited by Bobrocket

  • 4 weeks later...
    private void loop() {
        while (true) {
            try {
                IMouseTarget currentTarget = targetQueue.poll();
                if (currentTarget != null) {
                    while (!currentTarget.run(context)) Thread.sleep(50);
                }
                Thread.sleep(20);
            }
            catch (Exception ex) { }
        }
    }

nice infinite loop my friend

  • 2 weeks later...
  • Author
    private void loop() {
        while (true) {
            try {
                IMouseTarget currentTarget = targetQueue.poll();
                if (currentTarget != null) {
                    while (!currentTarget.run(context)) Thread.sleep(50);
                }
                Thread.sleep(20);
            }
            catch (Exception ex) { }
        }
    }

nice infinite loop my friend

 

 

 

schedulingThread = new Thread(() -> loop());

ok

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.