Jump to content

Widgets Issue


R3G3N

Recommended Posts

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 by ElloPOPz
Link to comment
Share on other sites

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");
                }
            }

Link to comment
Share on other sites

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 by Acerd
Link to comment
Share on other sites

Yeah... this is my first script I'm writing. Trying to learn how to script wink.png

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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