Jump to content

Little question


Daviyow

Recommended Posts

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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

 

 

 

is there a easier way to collect the widget message and use the value as a int? can't get out of this it just keeps giving npe no matter what i try,

Edited by Daviyow
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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 :)!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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