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.

Logger says NPC is null but in reality it isn't?

Featured Replies

This has never happened to me so I'm kind of confused why this is happening; basically it walks to an area and interacts with NPC and logs that npc isnt null, goes to bank and then goes back to the area , however this time it logs that the NPC is null.

What am I doing wrong?

code:

NPC npc = getNpcs().closest("NPC"); // onloop
     if (!area.contains(myPlayer()) {
       getWalking().webWalk(area);
            } else {
          if (npc != null) {
       log("npc is not null");
         npc.interact();
          } else {
    log("npc is null");
        }
}

Edited by Acerd

  • Author

try elseif

ive tried dat too if u mean:

if (!area.contains(myPlayer()) {
getWalking().webWalk(area);
} else if (npc != null) {
log("npc not null");
}

Edited by Acerd

why not try 

 

  1.    NPC Goblin = npcs.closest("Goblin");
  2.             if (Goblin != null && !(Goblin.isUnderAttack())) //getMap().canReach(Goblin)
  3.             {
  4.                 if (Goblin.isVisible())
  5.                 {
  6.                     Goblin.interact(new String[]{"Attack"});
  7.                     new ConditionalSleep(3000)
  8.                     {                  
  9.                         @Override
  10.                         public boolean condition() throws InterruptedException
  11.                         {
  12.                             return myPlayer().isAnimating() || myPlayer().getInteracting() != null;
  13.                         }
  14.                     }.sleep();
  15.                     }
  16.                 }
  17.                 else if (!Goblin.isVisible())
  18.                 {
  19.                      this.camera.toEntity((Entity) Goblin);
  20.                      if (Goblin.exists() && !Goblin.isVisible())
  21.                      {
  22.                          walking.walk(Goblin);
  23.                          while(myPlayer().isMoving()) {
  24.                                sleep(250);
  25.                            }
  26.                 }

 

some unreadable code

 

In the future please use the code tags to format your code when posting/commenting in the scripting help section.

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.