Prolax Posted June 19, 2018 Posted June 19, 2018 Hi, Is there a method to get the current absorption points? So you know when to sip an absorption potion. Many thanks. Prolax
Chris Posted June 19, 2018 Posted June 19, 2018 11 minutes ago, Prolax said: Hi, Is there a method to get the current absorption points? So you know when to sip an absorption potion. Many thanks. Prolax getWidgets()
Prolax Posted June 19, 2018 Author Posted June 19, 2018 1 hour ago, Chris said: getWidgets() Ok thanks. I'm interested in how @Fruity implemented it.
aniki432789 Posted June 19, 2018 Posted June 19, 2018 (edited) something like: absorpWidget = getWidgets().get(202, 1, 9); .... currentAbsorp = Integer.parseInt(absorpWidget.getMessage()); Take the time to learn and understand how widgets work and how to use them. Edited June 19, 2018 by aniki432789
d0zza Posted June 20, 2018 Posted June 20, 2018 9 hours ago, Prolax said: Ok thanks. I'm interested in how @Fruity implemented it. Fruity would've implemented it using widgets. There's no magic method that gets absorption points. 1
Canidae Posted June 20, 2018 Posted June 20, 2018 12 hours ago, aniki432789 said: something like: absorpWidget = getWidgets().get(202, 1, 9); .... currentAbsorp = Integer.parseInt(absorpWidget.getMessage()); Take the time to learn and understand how widgets work and how to use them. Since widget IDs tend to change, you should use something different instead. For example text color, position or something else.
Chris Posted June 20, 2018 Posted June 20, 2018 17 hours ago, Prolax said: Ok thanks. I'm interested in how @Fruity implemented it. Filter with geWidgets() is probably how he did it.
Juggles Posted June 20, 2018 Posted June 20, 2018 widget convert to int make sure you remove "," else it will null when at 1,000 as Jamie said above, could just leech off Alek and do getNMZ().leech().getAbsorbPoints
Prolax Posted June 20, 2018 Author Posted June 20, 2018 3 hours ago, HeyImJamie said: Have you tried getAbsorbtionPoints(); 2 hours ago, Juggles said: widget convert to int make sure you remove "," else it will null when at 1,000 as Jamie said above, could just leech off Alek and do getNMZ().leech().getAbsorbPoints I'll suggest this to @Alek.
HeyImJamie Posted June 20, 2018 Posted June 20, 2018 (edited) 11 minutes ago, Prolax said: I'll suggest this to @Alek. Please don't. Just learn to use Widgets and make your own method. Edited June 20, 2018 by HeyImJamie
01053 Posted June 21, 2018 Posted June 21, 2018 (edited) public int getCurrentAbsorptionLevel() { final RS2Widget widget = script.getWidgets().get(202, 1, 9); if (widget != null && widget.isVisible() && widget.getMessage() != null) return Integer.parseInt(widget.getMessage().replace(",", "")); return 0; } Should work. Edited June 21, 2018 by 01053
Prolax Posted June 21, 2018 Author Posted June 21, 2018 2 hours ago, 01053 said: public int getCurrentAbsorptionLevel() { final RS2Widget widget = script.getWidgets().get(202, 1, 9); if (widget != null && widget.isVisible() && widget.getMessage() != null) return Integer.parseInt(widget.getMessage().replace(",", "")); return 0; } Should work. Thanks, I'll write my script this weekend and post it here.
Prolax Posted June 21, 2018 Author Posted June 21, 2018 Looks like myPlayer().getHealth() is deprecated, which method is now used to get the current health?
FrostBug Posted June 22, 2018 Posted June 22, 2018 On 6/21/2018 at 3:11 PM, Prolax said: Looks like myPlayer().getHealth() is deprecated, which method is now used to get the current health? getHealthPercent() and getHealthPercentCache() aren't deprecated