Jump to content

Need help with Widget (First Script)


RagBoys III

Recommended Posts

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