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.

Move mouse while waiting for tasks to complete

Featured Replies

Hey there,

I was wondering if it was possible to move the mouse while doing a task and waiting for it to complete.

Fx while Woodcutting, it hovers the mouse on the next nearby tree, while chopping another one.

Any help / tips appreciated! :)

While animating -> find another nearby tree -> move mouse over the tree

You can use the .hover(); method on any Entity, something like this, you'll still have to check which tree you're interacting with...

RS2Object tree = getObjects().closest("Oak");
if(!myPlayer().isAnimating()){
    tree.interact("Chop down");
} else {
    tree.hover();
}

Edited by GaetanoH

Hey there,

I was wondering if it was possible to move the mouse while doing a task and waiting for it to complete.

Fx while Woodcutting, it hovers the mouse on the next nearby tree, while chopping another one.

Any help / tips appreciated! smile.png

 

Maybe something like this?

 

Pseudo Code:

 

If we are chopping a tree:

    If we have not found another tree:

        Find another tree

    Else if we are not hovering over the other tree:

        Hover over the other tree

Else:

  Chop a tree

import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;

@ScriptManifest(author = "", name = "", info = "", version = 0.1, logo = "")
public class WoodCutter extends Script {

    private enum State{ CHOPPING, HOVERING }

    private RS2Object currentTree;
    private RS2Object hoverTree;

    private State getState(){
        if(currentTree != null && currentTree.exists() && myPlayer().isAnimating()) return State.HOVERING;
        return State.CHOPPING;
    }

    @Override
    public int onLoop() throws InterruptedException {
        switch (getState()){
            case CHOPPING:
                chop();
                break;
            case HOVERING:
                hoverNextTree();
                break;
        }
        return random(200, 300);
    }

    private void chop(){
        currentTree = getObjects().closest("Tree");
        if(currentTree != null){
            currentTree.interact("Chop down");
            new ConditionalSleep(5000) {
                @Override
                public boolean condition() throws InterruptedException {
                    return myPlayer().isAnimating();
                }
            }.sleep();
        }
    }

    private void hoverNextTree(){
        if(hoverTree == null || !hoverTree.exists()) {
            hoverTree = getObjects().closest(obj -> obj.getName().equals("Tree") && obj != currentTree);
        } else if(!getMouse().isOnCursor(hoverTree)) {
            hoverTree.hover();
        }
    }
}

 

You can use the .hover(); method on any Entity, something like this, you'll still have to check which tree you're interacting with...

RS2Object tree = getObjects().closest("Oak");
if(!myPlayer().isAnimating()){
    tree.interact("Chop down");
} else {
    tree.hover();
}

 

That would only hover over the same tree that you are cutting (the closest one)

Edited by Explv

  • Author

Thanks for the quick replies, this is surely a big help to me, thanks! :D

 

I will mess around with it :D

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.