June 2, 20223 yr Hello guys, I'm currently trying to code a script to craft gold necklace at a furnace and need some help. The problem is that my script can't seem to get a hold of the gold necklace widget. Here's the code. private int goldBarID = 2357; private int goldNecklaceID = 1654; RS2Widget furnaceCraftWidget = getWidgets().singleFilter(446 , rs2Widget -> rs2Widget != null && rs2Widget.getItemId() == goldNecklaceID); if (furnaceCraftWidget != null) { log("test"); } if (furnaceCraftWidget != null && furnaceCraftWidget.interact("Make")) { log("it works"); new ConditionalSleep(90000) { @Override public boolean condition() { return !inventory.contains(goldBarID) || getDialogues().isPendingContinuation(); } }.sleep(); } At first I thought it might be the interact method that didn't work so I added the first test to check if I could get a hold of any widget at all but still nothing prints to the logger. The other thing I tried is using this instead of the singleFilter function RS2Widget furnaceCraftWidget = getWidgets().get(446, 22); But even by using childID i couldn't get a hold of the right widget. Only "test" printed in the logger, but the script didn't interact to craft gold necklaces. When I tried this I also got this error with many more all related to awt and swing which I am not using. Unless it's the in game interface that is using awt and swing? ERROR][06/02 05:19:55 PM]: Uncaught exception! java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location I tried searching on the forum and couldn't find anything to understand what I'm doing wrong. Thanks for the help guys.
June 3, 20223 yr Author Wow I didn't know that debugger existed thanks a lot. I tried 23 also and it only printed "test", but the debugger listed the action as "Make Gold necklace" and not just "Make" like I initially thought so changing this fixed it. I'll figure something so I don't have to hard code all the values though. Thanks
June 3, 20223 yr Slightly unrelated but a quick tip: you could optionally do myWidget.interact(); and give no parameters to select the first option that it has, can help in some situations
June 3, 20223 yr Author 3 hours ago, Czar said: Slightly unrelated but a quick tip: you could optionally do myWidget.interact(); and give no parameters to select the first option that it has, can help in some situations Thanks I'll keep that in mind, it could be a potential fix for some things later on haha.
Create an account or sign in to comment