justanotherkid Posted April 17, 2016 Share Posted April 17, 2016 could someone explain the widget api and how to use them? thanks! there currently isn't any resources for understanding them 1 Quote Link to comment Share on other sites More sharing options...
Explv Posted April 17, 2016 Share Posted April 17, 2016 (edited) could someone explain the widget api and how to use them? thanks! there currently isn't any resources for understanding them Step 1) Go to settings -> options -> debug -> tick Widgets Step 2) Hover your mouse over the part of the screen you want to be able to interact with using widgets In this case, the mouse is hovering over the skills tab. You can see three rectangles. Green, red and white. For each of these rectangles, the corresponding widget ids can be seen on the left. The top most id is the parent id, below that is the child id. For some widgets there may be three ids, the third is just a child of the second id. In this case we want to get the widget for the green rectangle, so in code this would be: RS2Widget skillTab = getWidgets().get(548, 53); When accessing widgets, if a widget is not on screen it will be null, so always make sure to null check your widgets. You can now interact with this widget for example: private void openSkillTab(){ RS2Widget skillTab = getWidgets().get(548, 53); if(skillTab != null) skillTab.interact(); } If you are ever trying to interact with a widget that has text in it, just find the widget using the text, this is a more reliable solution, for example: RS2Widget troutWidget = getWidgets().getWidgetContainingText("Raw trout"); Edited April 17, 2016 by Explv 2 1 Quote Link to comment Share on other sites More sharing options...
TFW Posted April 17, 2016 Share Posted April 17, 2016 (edited) http://osbot.org/api/org/osbot/rs07/api/ui/RS2Widget.html http://osbot.org/api/org/osbot/rs07/api/Widgets.html public class Widgetsextends FilterAPI<RS2Widget> Represents the API regarding widget (previously called interfaces) functionality. Lets start by creating our variable. Well call the RS2Widget RS2Widget interface1; initiate the variable and we grab widgets like this interface1 = getWidgets().get(PARENT_ID, CHILD_ID); To find out how to get the PARENT_ID, CHILD_ID we go here We then want to select a interface I chose the inventory interface debugger follows a color scheme find the interface you would like with the matching colour. R = 548 is our widget parent id - = 55 is our widget child id we then can finish interface1 = getWidgets().get(548, 55); we then can interact with the widget interface1 = getWidgets().get(548, 55); if (interface1 != null) interface1.interact("action"); fuk u explv u beat me to it Edited April 17, 2016 by TFW 2 1 Quote Link to comment Share on other sites More sharing options...
GaetanoH Posted April 17, 2016 Share Posted April 17, 2016 Step 1) Go to settings -> options -> debug -> tick Widgets Step 2) Hover your mouse over the part of the screen you want to be able to interact with using widgets In this case, the mouse is hovering over the skills tab. You can see three rectangles. Green, red and white. For each of these rectangles, the corresponding widget ids can be seen on the left. The top most id is the parent id, below that is the child id. For some widgets there may be three ids, the third is just a child of the second id. In this case we want to get the widget for the green rectangle, so in code this would be: RS2Widget skillTab = getWidgets().get(548, 53); When accessing widgets, if a widget is not on screen it will be null, so always make sure to null check your widgets. You can now interact with this widget for example: private void openSkillTab(){ RS2Widget skillTab = getWidgets().get(548, 53); if(skillTab != null) skillTab.interact(); } If you are ever trying to interact with a widget that has text in it, just find the widget using the text, this is a more reliable solution, for example: RS2Widget troutWidget = getWidgets().getWidgetContainingText("Raw trout"); Explv back at it again! Quote Link to comment Share on other sites More sharing options...
justanotherkid Posted April 17, 2016 Author Share Posted April 17, 2016 thanks guys, it's much simpler than i thought 1 Quote Link to comment Share on other sites More sharing options...
TFW Posted April 18, 2016 Share Posted April 18, 2016 thanks guys, it's much simpler than i thought I added it to my small basic guide in the tutorial section. Just incase you need it later Quote Link to comment Share on other sites More sharing options...