Skip 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.

client freezing

Featured Replies

The first bit of code runs smoothly, but the 2nd freezes my client... any ideas?

if(!player.isAnimating()){
  if (!player.isMoving()){
      wheel.interact("Spin"); //Wheel is now visible, spin bowstring
      sleep(random(700, 3000));
      spinMenu.hover();
      mouse.click(true);

     if(menu.isOpen()){
        sleep(random(700, 3000));
        menu.selectAction("Make X");
      }
   }
}

vs 

 

if(!player.isAnimating()){
    if (!player.isMoving()){
      if(!spinMenu.isVisible()){
         wheel.interact("Spin"); //Wheel is now visible, spin bowstring
         sleep(random(700, 3000));
       }

       spinMenu.hover();
       mouse.click(true);

      if(menu.isOpen()){
       sleep(random(700, 3000));
       menu.selectAction("Make X");
      }
   }
}
 

Edited by ni562

 

The first bit of code runs smoothly, but the 2nd freezes my client... any ideas?

if(!player.isAnimating()){
  if (!player.isMoving()){
      wheel.interact("Spin"); //Wheel is now visible, spin bowstring
      sleep(random(700, 3000));
      spinMenu.hover();
      mouse.click(true);

     if(menu.isOpen()){
        sleep(random(700, 3000));
        menu.selectAction("Make X");
      }
   }
}

vs 

 

if(!player.isAnimating()){
    if (!player.isMoving()){
      if(!spinMenu.isVisible()){
         wheel.interact("Spin"); //Wheel is now visible, spin bowstring
         sleep(random(700, 3000));
       }

       spinMenu.hover();
       mouse.click(true);

      if(menu.isOpen()){
       sleep(random(700, 3000));
       menu.selectAction("Make X");
      }
   }
}

 

 

Perhaps you should take a look at the debugging console. You can find it under settings -> show logger.

 

You can then determine your error from the output. Probably a NPE.

 

Your logic and code structure could also use some improvement smile.png

if(!myPlayer().isAnimating() && !myPlayer().isMoving()){

    RS2Widget spinMenu = getWidgets().get(); // Whatever you do to get the spin menu

    if(spinMenu == null || !spinMenu.isVisible()){

         wheel.interact("Spin");
         sleep(random(700, 3000));
    } else {

         spinMenu.interact("Make X");
    }
}

Edited by Explv

 if(!spinMenu.isVisible()){
         wheel.interact("Spin"); //Wheel is now visible, spin bowstring
         sleep(random(700, 3000));
 }

Perhaps you should take a look at the debugging console. You can find it under settings -> show log (or something similar).

 

My guess is you probably have a null pointer exception.

 

for sure just because he didn't do a null check with spinMenu

 

 

op:

btw spinMenu is a widget  null check it before using it. And you can use its built in interaction method

 

spinMenu.interact("ACTION");

 

it already search menu action for action.

 

 

  • Author

 

Perhaps you should take a look at the debugging console. You can find it under settings -> show logger.

 

You can then determine your error from the output. Probably a NPE.

 

Your logic and code structure could also use some improvement smile.png

if(!myPlayer().isAnimating() && !myPlayer().isMoving()){

    RS2Widget spinMenu = getWidgets().get(); // Whatever you do to get the spin menu

    if(spinMenu == null || !spinMenu.isVisible()){

         wheel.interact("Spin");
         sleep(random(700, 3000));
    } else {

         spinMenu.interact("Make X");
    }
}

Hey thanks, that seems to fix the issue...

 

 

if i change you're code from 

if(spinMenu == null || !spinMenu.isVisible()){

 to

if (!spinMenu.isVisible()) {

 I get a null pointer on that line...How come it works when I check for null, but crashes when i don't?

 

Hey thanks, that seems to fix the issue...

 

 

if i change you're code from 

if(spinMenu == null || !spinMenu.isVisible()){

 to

if (!spinMenu.isVisible()) {

 I get a null pointer on that line...How come it works when I check for null, but crashes when i don't?

 

 

Because when the widget is not on screen, when you do getWidegets().get()  it will return null.

 

So always make sure you null check :)

 

  • Author

Because when the widget is not on screen, when you do getWidegets().get()  it will return null.

 

So always make sure you null check smile.png

 

 

I'm not sure i follow..how does checking for null not make it crash? Does it skip the 2nd condition because it's an or and the first condition was true?

I'm not sure i follow..how does checking for null not make it crash? Does it skip the 2nd condition because it's an or and the first condition was true?

 

Yes, it is a logical OR  ||  so the second condition in the OR is not checked if the first evaluates to true.

 

If you were to use a bitwise OR  |  then both sides of the condition would be checked and a null pointer exception thrown.

  • Author

Yes, it is a logical OR  ||  so the second condition in the OR is not checked if the first evaluates to true.

 

If you were to use a bitwise OR  |  then both sides of the condition would be checked and a null pointer exception thrown.

 

 

sweeet, i didn't know that...Im sure it'll be useful in the future.  Thanks for the help dude

  • Author

I realized the 2nd part of the if statement was useless...it will never get to the 2nd condition.

if(spinMenu == null || !spinMenu.isVisible()){

is the same as

if(spinMenu == null ){

because if (spinMenu == null) then it's deff not visible and if it's not null then it is visible.

I realized the 2nd part of the if statement was useless...it will never get to the 2nd condition.

if(spinMenu == null || !spinMenu.isVisible()){

is the same as

if(spinMenu == null ){

because if (spinMenu == null) then it's deff not visible and if it's not null then it is visible.

 

Pretty much :P

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.