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.

Nightmare Zone

Featured Replies

how does this work? how can i get some number out of this: yes am a noobie, thanks!

public int getCurrentDrinkLevel() {
        RS2Widget widget = getWidgets().get(202, 1, 9);
        if (widget != null && widget.isVisible() && widget.getMessage() != null)
            return Integer.parseInt(widget.getMessage().replace(",", ""));
        return 0;
    }

 

This method reads a RS2Widget for a message, a widget is a UI component in runescape, in this case the widget to be read is the absorption widget in NMZ. 

To read a widget you must first get an instance of it. The line RS2Widget widget = getWidgets().get(202, 1, 9) does that. The parameters in the get method are .get(rootID, child+ ID, child++ ID). Every widget can be identified by these 3 parameters, in some cases it can be identified by 2. 

It is better to obtain widgets through only the rootID through an API method that can identify widgets via a unique sprite, text, options, ect because child IDs may change over game updates. However I have use the above snippet in my own code for several months and have not seen IDs change yet. If you are just learning widgets don't bother with the better practice and just get it working first. 

This image shows an example of the absorption widget's ids and the widget itself's instance variables. The message instance variable contains the player's absorption level. 

https://imgur.com/8U5TKE6

 

Edited by PayPalMeRSGP

  • Author
4 hours ago, PayPalMeRSGP said:

This method reads a RS2Widget for a message, a widget is a UI component in runescape, in this case the widget to be read is the absorption widget in NMZ. 

To read a widget you must first get an instance of it. The line RS2Widget widget = getWidgets().get(202, 1, 9) does that. The parameters in the get method are .get(rootID, child+ ID, child++ ID). Every widget can be identified by these 3 parameters, in some cases it can be identified by 2. 

It is better to obtain widgets through only the rootID through an API method that can identify widgets via a unique sprite, text, options, ect because child IDs may change over game updates. However I have use the above snippet in my own code for several months and have not seen IDs change yet. If you are just learning widgets don't bother with the better practice and just get it working first. 

This image shows an example of the absorption widget's ids and the widget itself's instance variables. The message instance variable contains the player's absorption level. 

https://imgur.com/8U5TKE6

 

thanks. i already knew this, i know the basics and i know how to use widgets (for example interacting with them etc etc.), BUT how can i use this snippet what i posted in my code? where do i put it? do i need to do something like if (getCurrentDrinkLevel > 100) ??? thats what i ment... or do i need to put my absorption level number between these " "'s in the snippet? *i tried something stupid like this: 

if (widget.getMessage().contains("970")) {
                    inventory.interact("Drink", "Absorption potion(4)", "Absorption potion(3)", "Absorption potion(2)", "Absorption potion(1)");
                }

 

Edited by alkku15

14 hours ago, alkku15 said:

thanks. i already knew this, i know the basics and i know how to use widgets (for example interacting with them etc etc.), BUT how can i use this snippet what i posted in my code? where do i put it? do i need to do something like if (getCurrentDrinkLevel > 100) ??? thats what i ment... or do i need to put my absorption level number between these " "'s in the snippet? *i tried something stupid like this: 

if (widget.getMessage().contains("970")) {
                    inventory.interact("Drink", "Absorption potion(4)", "Absorption potion(3)", "Absorption potion(2)", "Absorption potion(1)");
                }

 

It's clear that the method you've posted returns an Integer, so you'd check getCurrentDrinkLevel() > 100. The fact you can't figure that out though suggests to me you need to go and read up a little bit more on basic variables / methods. 

  • Author
On 5/19/2018 at 10:03 PM, HeyImJamie said:

It's clear that the method you've posted returns an Integer, so you'd check getCurrentDrinkLevel() > 100. The fact you can't figure that out though suggests to me you need to go and read up a little bit more on basic variables / methods. 

ye ikr im a noob at coding but why doesn't this work? i drank abs all the way to 450, then ran the script for 1min didnt do anything

if (getCurrentDrinkLevel() < 500) {
                inventory.interact("Drink", "Absorption potion(4)", "Absorption potion(3)", "Absorption potion(2)", "Absorption potion(1)");
            }

 

45 minutes ago, alkku15 said:

ye ikr im a noob at coding but why doesn't this work? i drank abs all the way to 450, then ran the script for 1min didnt do anything

if (getCurrentDrinkLevel() < 500) {
                inventory.interact("Drink", "Absorption potion(4)", "Absorption potion(3)", "Absorption potion(2)", "Absorption potion(1)");
            }

 

The potions are called Absorption(4). not Absorption potion(4). You have ur strings wrong. 

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.