October 9, 20187 yr I'm trying to make a tanning script at Al-Kharid. However, I am trying find the widget for each of the hides you can tan. However, I cannot find them. When I get all widgets and I try to look at actions if there is one with "Tan" in it, but I also cannot find any. How can I find the widget?
October 9, 20187 yr Author 1 hour ago, Juggles said: The action is "Tan All". Get root ID, filter What I meant was: List<RS2Widget> list = getWidgets().getAll(); for (RS2Widget widget : list) { String[] actions = widget.getInteractActions(); if (actions != null) { for (String action : widget.getInteractActions()) { if (action != null && action.toLowerCase().contains("tan")) { log(widget.getRootId() + ", " + widget.getSecondLevelId()); } } } } But this didn't work. So I followed your advice and tried this: for (int i = 0; i <= 999; i ++) { List<RS2Widget> list = getWidgets().containingActions(i, "Tan All"); if (list.size() > 0) { log(i); } } But this gives a ArrayIndexOutOfBoundsException (At 616) before outputting anything. I even tried to bruteforce with rootID, secondLevelID, thirdLevelID between 0 and 999 and it still returns nothing.
October 10, 20187 yr 1. Trade Ellis 2. Check that the widget is visible getWidgets().get(rootid, childid).isVisible(); For Green D'Hides it's (324, 3) 3. Then interact with the widget using "Tan all" getWidgets().get(324,3).interact("Tan all");
October 10, 20187 yr 15 hours ago, feggit said: What I meant was: List<RS2Widget> list = getWidgets().getAll(); for (RS2Widget widget : list) { String[] actions = widget.getInteractActions(); if (actions != null) { for (String action : widget.getInteractActions()) { if (action != null && action.toLowerCase().contains("tan")) { log(widget.getRootId() + ", " + widget.getSecondLevelId()); } } } } But this didn't work. So I followed your advice and tried this: for (int i = 0; i <= 999; i ++) { List<RS2Widget> list = getWidgets().containingActions(i, "Tan All"); if (list.size() > 0) { log(i); } } But this gives a ArrayIndexOutOfBoundsException (At 616) before outputting anything. I even tried to bruteforce with rootID, secondLevelID, thirdLevelID between 0 and 999 and it still returns nothing. Hey, I don't thing that would work, because what if you want to only tan a black dh and it would tan a green one. The way I do it is with a static ids(last time I check you can only use Widged ids as a static): private RS2Widget getRightWidget() { if(api.inventory.contains(Utils.DRAGONHIDES[0])) return api.widgets.get(324, 96); if(api.inventory.contains(Utils.DRAGONHIDES[1])) return api.widgets.get(324, 97); if(api.inventory.contains(Utils.DRAGONHIDES[2])) return api.widgets.get(324, 98); if(api.inventory.contains(Utils.DRAGONHIDES[3])) return api.widgets.get(324, 99); return null; } You can see for your self(a white square): Edited October 10, 20187 yr by smy
October 12, 20187 yr Instead of using widgets with ID, you could try using Widget's Text. My first script was a simple hard/soft leather Tanner at al kharid and the part I handled the widgets took me a long time to resolve, but with some help I was able to do something like this public void tanAll() throws InterruptedException{ RS2Widget tanningScreen = getWidgets().getWidgetContainingText("Hard leather"); tanningScreen.interact("Tan All"); } Hope it helps you. I'm willing to send you all my code if you wish to take a look at the whole process. Cheers!
Create an account or sign in to comment