Daviyow Posted September 25, 2015 Share Posted September 25, 2015 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); if anyone has a idea, please let me know:) cheers Quote Link to comment Share on other sites More sharing options...
Joseph Posted September 25, 2015 Share Posted September 25, 2015 (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 Edited September 25, 2015 by Joseph 1 Quote Link to comment Share on other sites More sharing options...
Tom Posted September 25, 2015 Share Posted September 25, 2015 What is that thing, an osbuddy feature or something? Better off checking the items in your inventory compared to overlays Quote Link to comment Share on other sites More sharing options...
Daviyow Posted September 25, 2015 Author Share Posted September 25, 2015 (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 September 25, 2015 by Daviyow 1 Quote Link to comment Share on other sites More sharing options...
Daviyow Posted September 25, 2015 Author Share Posted September 25, 2015 (edited) how come i'm getting a nullpointer on RS2Widget Absorbpts.. 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 Edited September 25, 2015 by Daviyow Quote Link to comment Share on other sites More sharing options...
FrostBug Posted September 25, 2015 Share Posted September 25, 2015 how come i'm getting a nullpointer on RS2Widget Absorbpts.. 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. Quote Link to comment Share on other sites More sharing options...
Daviyow Posted September 25, 2015 Author Share Posted September 25, 2015 (edited) 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 September 25, 2015 by Daviyow Quote Link to comment Share on other sites More sharing options...
FrostBug Posted September 25, 2015 Share Posted September 25, 2015 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, I don't think so. Just check your nulls properly and you'll be fine :E Quote Link to comment Share on other sites More sharing options...
Daviyow Posted September 25, 2015 Author Share Posted September 25, 2015 I don't think so. Just check your nulls properly and you'll be fine :E what i dont get is, its saying that these are giving npe's 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 Quote Link to comment Share on other sites More sharing options...
Bobrocket Posted September 25, 2015 Share Posted September 25, 2015 what i dont get is, its saying that these are giving npe's 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 String abbysorby = (Absorbpts == null ? "-1" : Absorbpts.getMessage()); 2 Quote Link to comment Share on other sites More sharing options...
FrostBug Posted September 25, 2015 Share Posted September 25, 2015 what i dont get is, its saying that these are giving npe's 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 1 Quote Link to comment Share on other sites More sharing options...
Daviyow Posted September 26, 2015 Author Share Posted September 26, 2015 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);", 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 Quote Link to comment Share on other sites More sharing options...
Joseph Posted September 26, 2015 Share Posted September 26, 2015 Integer.valueof is not the way to convert a string into an int. Null check the widget before grabbing it's message. Yes to the question above me. 1 Quote Link to comment Share on other sites More sharing options...
FrostBug Posted September 26, 2015 Share Posted September 26, 2015 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);", what is it trying to say? is the string still nulled? doesn't this say, if absorbpts is null, make it -1 ? thanks again 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. 1 Quote Link to comment Share on other sites More sharing options...
Daviyow Posted September 26, 2015 Author Share Posted September 26, 2015 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 202,1,9 if i've been to nmz and drank one, it shows this if i just login, it shows this 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 ! Quote Link to comment Share on other sites More sharing options...