Jump to content

Little question


Recommended Posts

Posted

Hi, im trying to get values from this widget here, and i have a question how i need to do that, because i need to use lower than and higher than, and with this i can only use Equals, im currently using this:

 

RS2Widget absPts = widgets.get(202, 9);

 

 

306c50d4a1.jpg

 

if anyone has a idea, please let me know:)

 

cheers

Posted (edited)

Open up widget debugger. Use the widget you want to Debug. See if it give you the value maybe in the message, or tool tip, idk just look through the debug for the value

 

 

nvm thanks man i used this to convert the stringto a int

 

        RS2Widget 1 = widgets.get(x, x,x);

        String abbysorby = 1.getMessage();

        int absPts = Integer.valueOf(abbysorby);

Edited by Daviyow
  • Like 1
Posted

how come i'm getting a nullpointer on RS2Widget Absorbpts..

 

bf46590e7e.png

 

before i use absPts in any states in my getState i nullcheck Absorbpts & abbysorby, and i can't seem to nullcheck absPts any ideas why? can't figure it out

 

The NPE is probably thrown in your getState method when the widget is unavailable.

 

Posted

what i dont get is, its saying that  these are giving npe's

88d3831155.png

 

even if im not using any of those methods, i can't nullcheck these right? its so confusing wow lol didn't do this in a looooong time

 

Widgets#get(int, int, int) will return null if the widget is not found. So when you call getMessage on a null reference, you get an NPE

  • Like 1
Posted

thanks for the replies & help, really appreciate it :), i've replaced it and now im getting one more error, the last line, " absPts = Integer.valueOf(abbysorby);",

 

8187bf4785.png

 

what is it trying to say? is the string still nulled?

 

 

String abbysorby = (Absorbpts == null ? "-1" : Absorbpts.getMessage());

 

doesn't this say, if absorbpts is null, make it -1 ?

 

thanks again :)

Posted

thanks for the replies & help, really appreciate it smile.png, i've replaced it and now im getting one more error, the last line, " absPts = Integer.valueOf(abbysorby);",

 

8187bf4785.png

 

what is it trying to say? is the string still nulled?

 

 

doesn't this say, if absorbpts is null, make it -1 ?

 

thanks again smile.png

 

The exception is telling you that the message of the widget is empty ("" in other words). So you probably have the incorrect widget; or the number was never in the message field of the widget in the first place. Try using the widget value debugger to find the correct widget/field.

 

  • Like 1
Posted

The exception is telling you that the message of the widget is empty ("" in other words). So you probably have the incorrect widget; or the number was never in the message field of the widget in the first place. Try using the widget value debugger to find the correct widget/field.

 

 

pretty sure i have the correct widget :s 202,1,9

 

if i've been to nmz and drank one, it shows this

 

c566f5f4ab.png

 

if i just login, it shows this

97c1369e2f.png

 

so i need to somehow nullcheck the widget but its already been done by

String abbysorby = (Absorbpts == null ? "-1" : Absorbpts.getMessage());

? thanks for all the help btw :)

fixed it, i changed

String abbysorby = (Absorbpts == null ? "-1" : Absorbpts.getMessage());

to

String abbysorby = (!Absorbpts.isVisible() ? "0" : Absorbpts.getMessage());

thanks for all the help appreciate it :)!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...