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.

if (YEW == null) is not working

Featured Replies

Entity YEW = objects.closest("Yew");

if(YEW != null){
            log("Found")
        }
if (YEW == null) {
            log("Not Found")
        }

 

YEW == null never works even if i chopped down yew boolean returns true how come?!?!

Edited by kadiem

  • Author
4 minutes ago, Eliot said:

The value of "YEW" will never change unless you set it again.

What do you mean?

Respectfully, you may want to learn a bit more Java and post your entire script here for people to help.

13 minutes ago, kadiem said:

Entity YEW = objects.closest("Yew");

if(YEW != null){
            log("Found")
        }
if (YEW == null) {
            log("Not Found")
        }

 

YEW == null never works even if i chopped down yew boolean returns true how come?!?!

if(YEW != null){
            log("Found")
        }
else{
            log("Not Found")
        }

 

doesn't work?

Edited by Get Rekt

  • Author
1 minute ago, Get Rekt said:

if(YEW != null){
            log("Found")
        }
{
            log("Not Found")
        }

 

doesn't work?

if you meant else no it does not work

 

if(YEW != null){
           log("Found")
        }else{
           log("Not Found")
        }

 

could try to add .exists() which @Tom taught me to complement it

mabye this works?
Also, why use entity, it's an interface, but your Yew tree is always gonna be a RS2 object. 

RS2Object YEW = objects.closest("Yew");

if(YEW != null){
            log("Found")
        }
if (YEW == null || !YEW.exists()) {
            log("Not Found")
        }

 

  • Author
14 minutes ago, slazter said:

could try to add .exists() which @Tom taught me to complement it

mabye this works?
Also, why use entity, it's an interface, but your Yew tree is always gonna be a RS2 object. 


RS2Object YEW = objects.closest("Yew");

if(YEW != null){
            log("Found")
        }
if (YEW == null || !YEW.exists()) {
            log("Not Found")
        }

 

 

Didn't work either

If you want to learn, at least provide your code and what you intend to do.

You have to update the tree object. 

 

You most likely initialized the tree object but failed updating the variable. 

Edited by dreameo

  • Author
3 minutes ago, dreameo said:

You have to update the tree object. 

 

You most likely initialized the tree object but failed updating the variable. 

 

Sorry I'm still new to java didn't understand what you mean

lol, you just have to put your code in the right spot, but we don't have the source.

 

Easiest thing to do is put it in the onLoop but that's a short term fix (for your overall development) 

24 minutes ago, slazter said:

could try to add .exists() which @Tom taught me to complement it

mabye this works?
Also, why use entity, it's an interface, but your Yew tree is always gonna be a RS2 object. 


RS2Object YEW = objects.closest("Yew");

if(YEW != null){
            log("Found")
        }
if (YEW == null || !YEW.exists()) {
            log("Not Found")
        }

 

Would only really work with mining in the scenario I taught you, as the objects definition changes (colours on the rock), but the object isn't destroyed

14 minutes ago, Tom said:

Would only really work with mining in the scenario I taught you, as the objects definition changes (colours on the rock), but the object isn't destroyed

Exists is useful for trees too m8.

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.