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 a specific entity is null?

Featured Replies

d22761d99b.png

Area X: 2 Trees

Area Y: 1 Tree

 

How can I make is so that if my player is in Area Y and when that tree only is null, not the ones in Area X, my player runs to stand in Area X to wait for those trees to spawn or vice versa.

 

I'm hoping there is a way to check for entities in a specific area and if they are null so that I can perform an action based off that info.

id split the two areas and tree entities if that would work, then for example

 

if (treex != null && myPlayer().getInteracting() == null){
if (!myPlayer().isMoving()){
if (treex.isVisible()) {
treex.interact("chop");
}
}
}
 
else
 
if (treey != null && myPlayer().getInteracting() == null){
if (!myPlayer().isMoving()){
if (treey.isVisible()) {
treey.interact("chop");
}
}
}
 
 
Im rather new to scripting, so ignore me if im trying to go over my knowledge 

 

  • Author

That shits complicated

 

Would making the character run to first cut tree when all are null be just as complicated?

 

I'm hoping there is a way to check for entities in a specific area and if they are null so that I can perform an action based off that info.

        Entity tree = getObjects().closest("Yew tree");
        Area AreaY = new Area(1, 2, 3, 4);
        Area AreaX = new Area(2, 3, 4, 2);

        if (!myPlayer.isMoving() && !myPlayer.isAnimating()) {
        if (tree != null && AreaY.contains(tree.getPosition())) { //if tree exists & is in AreaY
            if (AreaY.contains(myPlayer().getPosition())) { //if we are in AreaY
                tree.interact("chop"); //chop
                return true;
            } else getWalking().walk(AreaY.getRandomPosition());//We aren't in Area Y->walk there
        }

        else if (tree != null && AreaX.contains(tree.getPosition())) { //if tree exists & in AreaX
            if (AreaX.contains(myPlayer().getPosition())) { //if we are in AreaX
                tree.interact("chop"); // chop tree
                return true;
            } else getWalking().walk(AreaX.getRandomPosition()); //we aren't in Area X->walk there
        }

Edited by Gold Scripts

  • Author
        Entity tree = getObjects().closest("Yew tree");
        Area AreaY = new Area(1, 2, 3, 4);
        Area AreaX = new Area(2, 3, 4, 2);

        if (!myPlayer.isMoving() && !myPlayer.isAnimating()) {
        if (tree != null && AreaY.contains(tree.getPosition())) { //if tree exists & is in AreaY
            if (AreaY.contains(myPlayer().getPosition())) { //if we are in AreaY
                tree.interact("chop"); //chop
                return true;
            } else getWalking().walk(AreaY.getRandomPosition());//We aren't in Area Y->walk there
        }

        else if (tree != null && AreaX.contains(tree.getPosition())) { //if tree exists & in AreaX
            if (AreaX.contains(myPlayer().getPosition())) { //if we are in AreaX
                tree.interact("chop"); // chop tree
                return true;
            } else getWalking().walk(AreaX.getRandomPosition()); //we aren't in Area X->walk there
        }

 

Thanks!

 

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.