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.

Check if stunned while thieving

Featured Replies

Just now figured out that using vertices count is the way to go.
The birds that appear add to your vertices count, bumping it up by 42. 
Set your starting vertices count in onStart. Then you can check if stunned by comparing it against your current vertex count. 

Something like...
 

// When player is stunned their vertices count goes up by ~42.
// Get baseline vertices when idle to determine when stunned.
MidStunUtil.approxVerticesCountStunned = myPlayer().getModel().getVerticesCount() + 42;
public static boolean isPlayerStunned() {
    return approxVerticesCountStunned - globalMethodProvider.myPlayer().getModel().getVerticesCount() <= 5;
}



I used to use player height (normal ~ 198, stunned ~ 240) but that doesn't work if player is wielding certain items like a staff that increases your height over 240. Checking animation also is a nogo, The animation id flips back to -1 before the stun ends. So you wouldn't be able to ConditionalSleep until unstunned. Player hp is also bad, what if dodgy necklace procs? 

 

Edited by yfoo

2 hours ago, yfoo said:

Just now figured out that using vertices count is the way to go.
The birds that appear add to your vertices count, bumping it up by 42. 
Set your starting vertices count in onStart. Then you can check if stunned by comparing it against your current vertex count. 

Something like...
 

// When player is stunned their vertices count goes up by ~42.
// Get baseline vertices when idle to determine when stunned.
MidStunUtil.approxVerticesCountStunned = myPlayer().getModel().getVerticesCount() + 42;
public static boolean isPlayerStunned() {
    return approxVerticesCountStunned - globalMethodProvider.myPlayer().getModel().getVerticesCount() <= 5;
}



I used to use player height (normal ~ 198, stunned ~ 240) but that doesn't work if player is wielding certain items like a staff that increases your height over 240. Checking animation also is a nogo, The animation id flips back to -1 before the stun ends. So you wouldn't be able to ConditionalSleep until unstunned. Player hp is also bad, what if dodgy necklace procs? 

 

 

 

So what I do for this is I have an onMessage set a boolean

public void onMessage(Message m) throws InterruptedException {
            if(m.getMessage().contains("You fail")) {
                isStunned = true;
            }
        

    }

 

On the top of my onLoop I have this

if(isStunned) {
                log("I am stunned");
                int myVertCount = myPlayer().getModel().getVerticesCount();
                if (inventory.contains("Coin pouch")) {
                    inventory.getItem("Coin pouch").interact("Open-all");
                } else if (needsToEat()) {
                    if (hasFood()) {
                        eatFood();
                    }
                }
                new ConditionalSleep(5_000) {@Override public boolean condition() {return myPlayer().getModel().getVerticesCount() < myVertCount;}}.sleep();
                log("I am no longer stunned");
                myTarget = null;
                isStunned = false;
            }

 

It works really well regardless of what you might be wielding as far as I've been able to tell.

  • Author
1 hour ago, Alakazizam said:

 

 

So what I do for this is I have an onMessage set a boolean

public void onMessage(Message m) throws InterruptedException {
            if(m.getMessage().contains("You fail")) {
                isStunned = true;
            }
        

    }

 

On the top of my onLoop I have this

if(isStunned) {
                log("I am stunned");
                int myVertCount = myPlayer().getModel().getVerticesCount();
                if (inventory.contains("Coin pouch")) {
                    inventory.getItem("Coin pouch").interact("Open-all");
                } else if (needsToEat()) {
                    if (hasFood()) {
                        eatFood();
                    }
                }
                new ConditionalSleep(5_000) {@Override public boolean condition() {return myPlayer().getModel().getVerticesCount() < myVertCount;}}.sleep();
                log("I am no longer stunned");
                myTarget = null;
                isStunned = false;
            }

 

It works really well regardless of what you might be wielding as far as I've been able to tell.

If you're are already using myVertCount to determine how long you're stunned you should go ahead and also use it to determine if you are stunned. There is no reason to use 2 since one can do both for you. 
 

Edited by yfoo

1 minute ago, yfoo said:

If you're are already using myVertCount to determine how long you're stunned you should go ahead and also use it to determine if you are stunned. There is no reason to use 2 since one can do both for you. 

I like to use the on message to start the stun because it's ignored by any sleeps that may be taking place on the onLoop. I use the vert count as the sleep condition because the amount of time that's passed before that point will change depending on if the coin pouch needs to be open or if food is being eaten. I also wasn't 100% how different any vert change differences would be between wearing different gear so I didn't want to use that to trigger the stun.

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.