jordyownn 2 Share Posted December 18, 2016 Hi, i am making a molten glass smelter. This i what i have for the smelting function: private void smelt(){ if(FurnaceArea.contains(getLocalPlayer())){ GameObject Furnace = getGameObjects().closest("Furnace"); if(getInventory().get("Bucket of sand").useOn(Furnace)) { } } else { if (getWalking().walk(FurnaceArea.getCenter())) { sleep(Calculations.random(3000,6000)); } } } i want to know when if(getInventory().get("Bucket of sand").useOn(Furnace)) returns true. How do i interact with the molten glass furnace screen and select make all? Thanks in advance. Link to comment Share on other sites More sharing options...
Hashtag 8693 Share Posted December 18, 2016 Hi there! First of all you should always null check everything. What happens when Furnace is null and you try to interact with it? It logs a bunch of NullPointerExceptions. Now those are very annoying errors to see. Luckily they are easy to fix. Simply check if Furnace is null before interacting with it. if (Furnace != null) { //continue to interact } To interact the glass furnace screen, use widgets. And remember to null check widgets too! Good luck =) Link to comment Share on other sites More sharing options...
Decipher 124 Share Posted December 18, 2016 Widgets ^ Link to comment Share on other sites More sharing options...
jordyownn 2 Author Share Posted December 18, 2016 Hey, thanks for helping. I know i need to use widgets, but how do i use them, this is my very first script. Can somebody write my an example snippet? is it something like this? getWidgets().getWidgetChild().interact("Make All"); Link to comment Share on other sites More sharing options...
rexas 12 Share Posted December 18, 2016 Try this WidgetChild child = getWidgets().getWidgetChildrenContainingText("Molten glass or whatever the name is").get(0); if(child != null) child.interact("Make All"); Or this if you know how to find widget ids with game debugger. WidgetChild child = getWidgets().getWidget(parentId).getChild(childId); if(child != null) child.interact("Make All"); Link to comment Share on other sites More sharing options...
jordyownn 2 Author Share Posted December 18, 2016 Try this WidgetChild child = getWidgets().getWidgetChildrenContainingText("Molten glass or whatever the name is").get(0); if(child != null) child.interact("Make All"); Thank you for this, this is working. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.