Ex0rcism Posted May 22, 2019 Share Posted May 22, 2019 (edited) I'm trying to develop my own mining script for motherlode mine, I need to verify how many Pay-dirt the player has in the sack before moving on to the next step. Does anyone have a solution on retrieving a widget text and returning it as an int? Note: I Have censored this heavily because I'm using my main, I don't need Jagex banning my account just by using a 3rd party client or for writing a script. All surrounding players have been censored too just in case they are a bot or Jagex staff. All the information you need is in the picture without any of my personal account details. *UPDATE*: I have managed to figure it out thanks for the help anyways. sackValue = Integer.parseInt(getWidgets().get(382, 4, 2).getMessage()); Please close thread. Edited May 22, 2019 by Ex0rcism Figured it out on my own. Thanks to bot's API Quote Link to comment Share on other sites More sharing options...
Ex0rcism Posted May 22, 2019 Author Share Posted May 22, 2019 17 minutes ago, Malcolm said: Although you can get away with using child widgets I would suggest finding another way to do this without using child widgets. Jagex change these widgets and if they do that your script will break. You could look into sprites and even colors and find which index the widget you're looking for is at. Sprite Ids don't change? Wonder how this could be achieved, because you're right I don't want to keep updating the script every Thursday lol. Quote Link to comment Share on other sites More sharing options...
Ex0rcism Posted May 22, 2019 Author Share Posted May 22, 2019 (edited) So this should be efficient enough to use: private int getSackWidgetRootId() { RS2Widget sackWidgetRoot = getWidgets().singleFilter(getWidgets().getAll(), w -> w.getSpriteIndex2() == -1 && w.getHeight() == 68 && w.getWidth() == 68); if (sackWidgetRoot != null) { return sackWidgetRoot.getRootId(); } return -1; } private int getSackValue() { List<RS2Widget> sackWidget = getWidgets().matchingTextColour(getSackWidgetRootId(), 13158600); if (sackWidget != null) { RS2Widget messageWidget = sackWidget.get(0); return Integer.parseInt(messageWidget.getMessage()); } return -1; } Thank you @Malcolm and @MasterOfData for all the help I needed to achieve this! Topic can now be closed. Edited May 22, 2019 by Ex0rcism 1 Quote Link to comment Share on other sites More sharing options...