Mountain Troll Posted March 31, 2020 Share Posted March 31, 2020 (edited) Im trying to make my script more friendly by making it search for the widgets rather than using fixed ids, after a while on the api i found getWidgetContainingText, so i went to the code that changes the settings on start. Im trying to change the roof setting, so the first widget it goes for is the Display tab, but with some testing if the chat tab is open it will go towards the display name option. Is there any other method i could use without using a widget list? Edit: Started messing with the widget debugger and found its sprite id Edited March 31, 2020 by Mountain Troll Quote Link to comment Share on other sites More sharing options...
Eagle Scripts Posted March 31, 2020 Share Posted March 31, 2020 (edited) 10 minutes ago, Mountain Troll said: Im trying to make my script more friendly by making it search for the widgets rather than using fixed ids, after a while on the api i found getWidgetContainingText, so i went to the code that changes the settings on start. Im trying to change the roof setting, so the first widget it goes for is the Display tab, but with some testing if the chat tab is open it will go towards the display name option. Is there any other method i could use without using a widget list? I'm not entirely sure what your exact question is so I'm not sure if my reply will answer it. Look into filters. e.g.: public class WidgetMessagesFilter implements Filter<RS2Widget> { private final String[] messages; public WidgetMessagesFilter(final String... messages) { this.messages = messages; } @Override public final boolean match(final RS2Widget rs2Widget) { if (rs2Widget == null || !rs2Widget.isVisible() || rs2Widget.getMessage() == null) { return false; } return Arrays.stream(messages).anyMatch(m -> rs2Widget.getMessage().contains(m)); } } Usage: final RS2Widget loveEagleFilter = s.getWidgets().singleFilter(s.getWidgets().getAll(), new WidgetMessageFilter("TEXT HERE")); Edited March 31, 2020 by Eagle Scripts Quote Link to comment Share on other sites More sharing options...
Mountain Troll Posted March 31, 2020 Author Share Posted March 31, 2020 35 minutes ago, Eagle Scripts said: I'm not entirely sure what your exact question is so I'm not sure if my reply will answer it. Look into filters. e.g.: public class WidgetMessagesFilter implements Filter<RS2Widget> { private final String[] messages; public WidgetMessagesFilter(final String... messages) { this.messages = messages; } @Override public final boolean match(final RS2Widget rs2Widget) { if (rs2Widget == null || !rs2Widget.isVisible() || rs2Widget.getMessage() == null) { return false; } return Arrays.stream(messages).anyMatch(m -> rs2Widget.getMessage().contains(m)); } } Usage: final RS2Widget loveEagleFilter = s.getWidgets().singleFilter(s.getWidgets().getAll(), new WidgetMessageFilter("TEXT HERE")); Thank you, although i found a different solution the help is appriciated. 1 Quote Link to comment Share on other sites More sharing options...
Eagle Scripts Posted March 31, 2020 Share Posted March 31, 2020 1 hour ago, Mountain Troll said: Thank you, although i found a different solution the help is appriciated. No problem at all. Mind sharing the solution with us? 1 Quote Link to comment Share on other sites More sharing options...
Mountain Troll Posted March 31, 2020 Author Share Posted March 31, 2020 7 minutes ago, Eagle Scripts said: No problem at all. Mind sharing the solution with us? Of course i dont mind. I think it was more of my own error as i was looking for a widget using text when there wasnt any. I had read about using sprite ids but had no clue how to get them, when i was just messing with the client options i found the widget debuggeder and then a way to find the sprite ids. All in all i believe is was my fault for not fully reading into what i was doing. 1 Quote Link to comment Share on other sites More sharing options...