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.

How to make ore detection more accurate?

Featured Replies

1 hour ago, loopback said:

I have that in my script already, and it checks if my player has been animating or moving. However my character still clicks 1-3 times per rock and randomly switches rocks for no reason, The ConditionalSleep has helped a bit (I am using the one from your tut) but they don't seem to solve the problem just work around it by delaying how much it happens.


        if (Iron != null && !isMining()) {
            log("chk_iron_mining");
            new Sleep(() -> !Rock.IRON.hasOre(Iron) || !isMining(), 10000).sleep();
            Iron.interact("Mine");
        }

    private boolean isMining() {

        if (myPlayer().isAnimating() && myPlayer().getInteracting() != null && myPlayer().isMoving()) {
            return true;
        }
            return false;
    }

            case MINEIron:

                sleep(900);
                MineIron();
                sleep(random(1250, 1600));
                break;

    private State getState() {
        if (getInventory().isFull())
            return State.BANK;
        if (!getInventory().isFull() && !isMining() && ore == 0)
            return State.MINECopper;
        if (!getInventory().isFull() && !isMining() && ore == 1)
            return State.MINETin;
        if (!isMining() && !getInventory().isFull() && ore == 2)
            return State.MINEIron;
        return State.WAIT;
    }

Relevant code snippets.

 

EDIT: I think one of the problems is that the animation for mining does not stop always if it has been depleted by someone else

I specified your problem, you are just incorrectly reading it. For a split second, the player will appear NOT to mine when it is and thus your condition will become true.

  • Author
1 hour ago, Final said:

I specified your problem, you are just incorrectly reading it. For a split second, the player will appear NOT to mine when it is and thus your condition will become true.

Ok I get it now, but how would I go about implementing the 3 or so second anim check?

5 hours ago, loopback said:

Ok I get it now, but how would I go about implementing the 3 or so second anim check?

You would store the current system time every time the player has animated successfully. If the player doesn't animate when you check, then you check if the last checked time surpasses 3000 milliseconds.

Psuedo-Code:

if (player is animating) then
	long lastCheckedTime = System.getCurrentTime
    else
		if (System.getCurrentTime - lastCheckedTime > 3000) then
           //The player is no longer mining.
        end if
end if

 

Edited by Final

  • Author

So this is my new isMining() and It works but has uncovered 2 other problems now, One is when the rocks deplete while I was mining them then my script waits for the animation to complete. And my script can not notice when the rock gets depleted. So I need a way to check if the rock I am currently mining has been depleted and if it has then just try to find a non depleted rock ( which I have a way of doing ) I just can't check while I am mining.

    private boolean isMining() {
        if ( myPlayer().isAnimating()) {
            long lastAnimation = System.currentTimeMillis();
            return true;
        } if (System.currentTimeMillis() - lastAnimation > 500) {
            return false;
        }
        return false;
    }

 

Edited by loopback

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.