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.

Script crashing becouse of widget

Featured Replies

My script keeps crashing when i try to interact with a widget.

I've tried putting in as action: "Make","Make Gold ring", "Make <col=ff9040>Gold ring</col>"

In the console:

Main.onStart(Main.java:37)

image.thumb.png.b59e81baf9763664cfb5724437c903d9.png

44: objects.closest("Furnace").interact("Smelt");
45: RS2Widget furnacewidget = widgets.get(446,7);
46: sleep(2000);
47: furnacewidget.interact("Make");

Edited by WSSL

You should always nullcheck and you should avoid using regular sleeps.

In your example you click on the furnace and in that time your character will still be moving (and 2sec is probably too short, you should use conditional sleeps here) and the interface isnt even open but you already get the widget. But since the interface isnt open you will get null and after your 2sec sleep you will try to interact with a widget thats null.

Also if you just try to execute a bunch of orders in a row like you do your script breaks the moment anything doesnt work as it should (lagg for example).

Much better would do doing something like:

if widget == null (means interface isnt open)

-> interact with furnace -> conditional sleep until widget != null (so interface is open)

else if widget != null (interface open)

-> interact with widget

So in the first loop your script would interact with the furnace and sleep until the interface is open and in the next loop it will interact with the widget.

 

Take a look at this tutorial:

 

Get used to writing scripts like this :)

if(furnancewidget != null){

furnancewidget.interact();

}

It doesn't mean it will make interactions work everytime, but it will save you from crashes. Also one thing I use myself, don't be afraid to use Mouse(); class, you dont have to use Widgets all the time, in this case Mouse(); would work too and it would keep on working if Jagex decide to change widget IDs which they do time to time

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.