Jump to content

Furnace crafting widget


Recommended Posts

Posted

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.

 

Posted

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 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...