Bobrocket Posted May 29, 2016 Share Posted May 29, 2016 (edited) 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 May 29, 2016 by Bobrocket 6 Quote Link to comment Share on other sites More sharing options...
Acerd Posted May 30, 2016 Share Posted May 30, 2016 good shit Quote Link to comment Share on other sites More sharing options...
Saiyan Posted June 1, 2016 Share Posted June 1, 2016 does one have to use bobby api tho Quote Link to comment Share on other sites More sharing options...
The Brogrammer Posted June 23, 2016 Share Posted June 23, 2016 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 Quote Link to comment Share on other sites More sharing options...
Bobrocket Posted July 6, 2016 Author Share Posted July 6, 2016 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 Quote Link to comment Share on other sites More sharing options...