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.

NMZ bot super laggy when it goes into NMZ

Featured Replies

Hello everyone, this is my first script.  It will probably look terrible to an experienced eye.  Currently it checks if it needs to bank, starts the previous dream, enters NMZ, kills Elvarg, loots his bones, leaves, and does it all again.  I'm running into the issue that NMZ is very laggy, script wont respond to user input, has high CPU and Memory usage.  Any advise is welcome! :)


                case FIGHT:
                {
                    target = npcs.closest("Elvarg");
                    target.interact("Attack");
                    sleep(random(2500, 4800));
                    new ConditionalSleep(4000, 500) {
                        @Override
                        public boolean condition() throws InterruptedException {
                            return myPlayer().isUnderAttack();
                        }
                          }.sleep();

Edited by csvernon

Check the logger, you are probably getting a nullPointer or something.

Check it and post it here :) 

  • Author

Error in Script executor!

java.lang.NullPointerException

                           at main.onLoop(Main.jva:85)

                           at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(ro:134)

                           at java.lang.Thread.run(Unknown Source)

 

seems to happen right after I turn on prayers to fight elvarg, so my script 

  target = npcs.closest("Elvarg");
                    target.interact("Attack");

seems busted

28 minutes ago, HunterRS said:

Check the logger, you are probably getting a nullPointer or something.

Check it and post it here :) 

Edited by csvernon

 

12 minutes ago, csvernon said:

Error in Script executor!

java.lang.NullPointerException

                           at main.onLoop(Main.jva:85)

                           at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(ro:134)

                           at java.lang.Thread.run(Unknown Source)

 

seems to happen right after I turn on prayers to fight elvarg, so my script 

  target = npcs.closest("Elvarg");
                    target.interact("Attack");

seems busted

Your problem is that you are not checking if you found the dragon,
change target.interact to:

if(target != null){
    target.interact("Attack");

also, look into conditional sleeps.

16 minutes ago, csvernon said:

Error in Script executor!

java.lang.NullPointerException

                           at main.onLoop(Main.jva:85)

                           at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(ro:134)

                           at java.lang.Thread.run(Unknown Source)

 

seems to happen right after I turn on prayers to fight elvarg, so my script 

  target = npcs.closest("Elvarg");
                    target.interact("Attack");

seems busted

If npcs.closest returns null, and you try to call interact on it, it will throw this error.

Null check it! i.e

target = npcs.closest("Elvarg");
if (target!=null && target.interact("Attack")) {
 // do stuff
}

Also, when you post code, please use the provided code formatting tool in the reply box; so that it's (more) readable. 

There are a host of other improvements that can be made on your code; but soon enough you will find these out when your script misbehaves!

GL!

Apa

  • Author

K, script no longer gets errors, but now it repeatedly attacks elvarg even while in combat, condition sleep isnt working.

Also 

getWalking().walk(new Position(6656, 6912, 1));

hasn't worked at all in NMZ

and when I click on the potion to enter NMZ 

 getObjects().closest("Plinth").interact("Drink");
                    mouse.click(false);

I have to force the mouse to click, if will just go to the object but wont interact.  The object is technically a potion that gains the "Drink" option after the dream is setup but I could only get the mouse to move there when using "Plinth" as the object.

Edited by csvernon

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.