R3G3N Posted June 11, 2016 Share Posted June 11, 2016 (edited) Hello guys, I'm trying to make a Al-Kharid Smelting bars script. One problem that I am having is that my script won't use the widgets. RS2Widget bronze = getWidgets().get(311, 4); if (bronze != null){ bronze.interact("Smelt X Bronze"); getKeyboard().typeString("" + (int)((Math.random()*99) + 30)); } I also tried RS2Widget bronze = getWidgets().getWidgetContainingText("Bronze") which also doesn't work. How come this code doesn't work? The code before this interacts with the furnace then the bar options pop up and then the script does nothing. Image: http://imgur.com/IYd0exp Edited June 11, 2016 by ElloPOPz Quote Link to comment Share on other sites More sharing options...
Acerd Posted June 12, 2016 Share Posted June 12, 2016 try "Smelt X" only? Quote Link to comment Share on other sites More sharing options...
R3G3N Posted June 12, 2016 Author Share Posted June 12, 2016 Nope does not work Here's my code for the widget: RS2Widget bronze = getWidgets().getWidgetContainingText("Bronze"); furnace.interact("Smelt"); if (bronze != null){ bronze.interact("Smelt X"); } Quote Link to comment Share on other sites More sharing options...
Acerd Posted June 12, 2016 Share Posted June 12, 2016 RS2Widget bronze = getWidgets().getWidgetContainingText("Bronze"); if (bronze != null){ bronze.interact("Smelt X"); } else { furnace.interact("Smelt"); } Quote Link to comment Share on other sites More sharing options...
R3G3N Posted June 12, 2016 Author Share Posted June 12, 2016 It doesn't work still Here's my code for traveling from bank to smelting place and smelting the bars RS2Object furnace = objects.closest("Furnace"); RS2Object bank = objects.closest("Bank booth"); RS2Widget bronze = getWidgets().getWidgetContainingText("Bronze"); final Area FURNACE_AREA = new Area(3274, 3184, 3279, 3188); final Area BANK_AREA = new Area(3269, 3166, 3271, 3169); if (!FURNACE_AREA.contains(myPlayer())){ getWalking().walk(FURNACE_AREA.getRandomPosition()); if (!myPlayer().isAnimating()){ if (bronze != null){ bronze.interact("Smelt X"); getKeyboard().typeString("" + (int)((Math.random()*99) + 30)); } else furnace.interact("Smelt"); } } Quote Link to comment Share on other sites More sharing options...
Acerd Posted June 12, 2016 Share Posted June 12, 2016 (edited) your logic is really bad :E there's a check if player is not in furnace area and there's an interact with furnace in there too. RS2Object furnace = objects.closest("Furnace"); RS2Object bank = objects.closest("Bank booth"); RS2Widget bronze = getWidgets().getWidgetContainingText("Bronze"); final Area FURNACE_AREA = new Area(3274, 3184, 3279, 3188); final Area BANK_AREA = new Area(3269, 3166, 3271, 3169); if (!FURNACE_AREA.contains(myPlayer())) { getWalking().walk(FURNACE_AREA.getRandomPosition()); } else { if (bronze != null) { bronze.interact("Smelt X"); sleep(1250); getKeyboard().typeString("" + (int)((Math.random()*99) + 30)); new ConditionalSleep(150_000) { @Override public boolean condition() throws InterruptedException { return !getInventory().contains("Tin ore"); } }.sleep(); } else { furnace.interact("Smelt"); new ConditionalSleep(5_000) { @Override public boolean condition() throws InterruptedException { return bronze != null; } }.sleep(); } } Edited June 12, 2016 by Acerd Quote Link to comment Share on other sites More sharing options...
R3G3N Posted June 12, 2016 Author Share Posted June 12, 2016 Yeah... this is my first script I'm writing. Trying to learn how to script ;) btw these errors pop up ConditionalSleep cannot be resolved to a type the method condition() of type new ConditionSleep(){} must override or implement a supertype method What do they mean? Thanks for helping Quote Link to comment Share on other sites More sharing options...
itzDot Posted June 12, 2016 Share Posted June 12, 2016 Make sure you also check if widget is visible Quote Link to comment Share on other sites More sharing options...
Acerd Posted June 12, 2016 Share Posted June 12, 2016 Yeah... this is my first script I'm writing. Trying to learn how to script btw these errors pop up ConditionalSleep cannot be resolved to a type the method condition() of type new ConditionSleep(){} must override or implement a supertype method What do they mean? Thanks for helping import conditionalSleep Quote Link to comment Share on other sites More sharing options...