Jump to content

Need help with Widget (First Script)


Recommended Posts

Posted (edited)

Hello, I've been looking around this community for a few days and I decided to make my first script to learn more about programming and runescape scripting more specifically.

The script should be really simple: tanning cowhides into hard leather

I've been following @Explv guide which can be found here: 

I'm stuck at one part, though.

Whenever I trade the NPC (Ellis), the following screen will pop up: 

 

ppQbFTm.png

If I right-click Hard Leather:

ckoVWRK.png

I'm not so sure how to tan all the Hard Leathers. Part of my code, which was based in an example found in the tutorial I mentioned earlier, is the following:

private boolean canMakeLeather(){
        return getInventory().contains("Cowhide");
    }

    private boolean tradeNPC(){
        return getNpcs().closest("Ellis").interact("Trade");

    }

    private boolean isTanningScreenVisible(){
        return getWidgets().getWidgetContainingText("What hides would you like tanning") != null;
    }

    private boolean tanningHides(){
        return getWidgets().getWidgetContainingText("Hard Leather").interact("Tan all");
    }

 

The example script code (smelting iron bars):

private boolean canSmeltIronBars() {
        return getInventory().contains("Iron ore");
    }

    private boolean useFurnace() {
        return getObjects().closest("Furnace").interact("Smelt");
    }

    private boolean isSmeltScreenVisible() {
        return getWidgets().getWidgetContainingText("What would you like to smelt?") != null;
    }

    private boolean smeltXIron() {
        return getWidgets().getWidgetContainingText("Iron").interact("Smelt X Iron");
    }

 

I'm just wondering if there is any mistake in the code or anything I could improve.

Obviously not the full script code, I just didn't really understand how to work with widgets.

Edited by RagBoys III

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...