Decipher 124 Posted January 5, 2017 Cipher's Guide on how to use Widgets! Chapter I: Finding widgets To interact with a widget, we must first find the widget. There are 2 ways of doing this: Method 1: "Widget Hover" Tool (not recommended) To use the widget hover tool, in your client go to Tools tab -> Debugging -> Click on "Tool: Widget Hover". It may take a couple of seconds for it to load, and it looks like this: The widget parents and childs (and grandchilds) are shown in the menu on the left. The boxes around the widgets you are hovering indicates which color it has in the menu. We will learn to use these in chapter II. Method 2: Debug Tool To open the debug tool, click the Tools tab -> Game Debugger. Once it opens click on the Widgets tab. You should see folders with numbers popping up: These are the widget parents. To find the widget you want to use, you can look for it by putting in something in one (or both) of the text fields, and hitting refresh. The "text" is usually something like "Ball of Wool" (aka what you can see) and the "action" is something like "Make All" (options that pop up when you right click on something). To expand the folders click the small node next to the folder icon, and select the file(s) to see the widgets information. Example: As you can see, a lot of information pops up. By looking at the Text and Actions you can determine if you found the correct widget. Chapter II: Using your widgets To interact with a widget, we must first check if it exists. If not you will get a null pointer exception, and your script wont work. To do this, simply use this: if (getWidgets().getWidget(parent).getChild(child) !=null) to use grand child, simply add another .getChild(grandchild) If you want to interact with it: //to click the widget: getWidgets().getWidget(parent).getChild(child).interact(); //to click a specific action: getWidgets().getWidget(parent).getChild(child).interact("Make X"); Sidenote: if you are using the same widget multiple times, you can make a widgetChild object to save time: WidgetChild x = getWidgets().getWidget(parent).getChild(child); Now you only need to type "x" instead of the full line of code. A full example: WidgetChild x = getWidgets().getWidget(parent).getChild(child); if (x !=null){ x.interact(); sleepUntil(() -> !getInventory().contains("Wool"), 30000); } Above code will check if the widget exists, and if it does click it and sleep until inventory doesnt contain "Wool", or 30000 milliseconds has passed.
Hashtag 9072 Posted January 5, 2017 WidgetChild x = getWidgets().getWidget(parent).getChild(child); Is the same as WidgetChild x = getWidgets().getWidgetChild(parent, child); //Can use as parent, child, child2, child4, etc... But other than that good tutorial.
Neffarion 486 Posted January 5, 2017 you should check if parent is null before checking if the child is null, otherwise you can get a npe. good stuff anyway WidgetChild x = getWidgets().getWidget(parent); if (x !=null){ if (x.getChild(child) != null){ x.getChild(child).interact(); sleepUntil(() -> !getInventory().contains("Wool"), 30000); } }
Before 97 Posted January 6, 2017 WidgetChild x = getWidgets().getWidget(parent).getChild(child); Is the same as WidgetChild x = getWidgets().getWidgetChild(parent, child); //Can use as parent, child, child2, child4, etc... But other than that good tutorial. that's what I use
Hashtag 9072 Posted January 6, 2017 you should check if parent is null before checking if the child is null, otherwise you can get a npe. good stuff anyway WidgetChild x = getWidgets().getWidget(parent); if (x !=null){ if (x.getChild(child) != null){ x.getChild(child).interact(); sleepUntil(() -> !getInventory().contains("Wool"), 30000); } } If you use getWidgetChild there is no need to check if parent is null. See my post above.
Kvothe 6 Posted January 20, 2017 Could someone write a code example of using a widget to Craft and X amount of something.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.