RS2Object furnace = objects.closest("Furnace");
RS2Widget options = widgets.get(311, 8);
furnace.interact("Smelt");
if (options != null) {
mouse.click(random(290, 325), random(393, 420), true);
sleep(random(1000, 1500));
menu.selectAction("Smelt X Gold");
sleep(random(1000,1500);
keyboard.typeString("" + random(29, 99), true);
}
Should be something like this.
Add an extra null check on the keyboard type string.