Jump to content

A better way to do this?


Broman

Recommended Posts

Hi,

ATM working with a fletching script. So far, so good.

        logs = scriptgui.getSelectedLogs();
        types = scriptgui.getSelectedType();
        toMake = String.valueOf(logs) + " " + String.valueOf(types);
        toUse = String.valueOf(logs) + " logs";

I am a bit unsure about this tho. logs and types are enums, toMake and toUse are strings. It works good, but if I wanted to fletch normal logs obviously it would not work. Any thoughts?

Link to comment
Share on other sites

13 minutes ago, Gunman said:

@Broman Why not just make them the full name and remove that + " logs" bit? ex Logs, Oak logs, etc.

For more simple GUI. 

eg. 

User selects Willow logs as material, and wishes to make longbow (u) out of it. 

(Yew, WIllow or Maple as material, make longbows)

If I wanted to, I could just let user select material and then select the respective item eg (Yew Logs, Yew longbow (u))

Link to comment
Share on other sites

17 minutes ago, Broman said:

For more simple GUI. 

eg. 

User selects Willow logs as material, and wishes to make longbow (u) out of it. 

(Yew, WIllow or Maple as material, make longbows)

If I wanted to, I could just let user select material and then select the respective item eg (Yew Logs, Yew longbow (u))

Are you talking like an AIO where it would have more than just logs to withdraw?

Link to comment
Share on other sites

8 minutes ago, Gunman said:

Are you talking like an AIO where it would have more than just logs to withdraw?

In the future yes. Currently I only support bows (u). Planning to release this as my first script, and I think that AIO Fletcher with support for bolts, darts etc should be a premium script. Also now that you are here, is the following a good way to interact with Widgets? 

if(getWidgets().interact(270, 16, 38, "Make")) {
  //conditionalSleeeep
}

 

Link to comment
Share on other sites

7 minutes ago, Broman said:

In the future yes. Currently I only support bows (u). Planning to release this as my first script, and I think that AIO Fletcher with support for bolts, darts etc should be a premium script. Also now that you are here, is the following a good way to interact with Widgets? 


if(getWidgets().interact(270, 16, 38, "Make")) {
  //conditionalSleeeep
}

 

If you want that on the SDN I don't think that would be allowed with the child ids being used

Link to comment
Share on other sites

1 hour ago, Gunman said:

Think they prefer text then sprite id.

Okay. So I changed it. Is using item id's from Widget considered OK? I cant seem to find any unique sprites / text for this one.

    private RS2Widget getFletchingMenu() {
        List<RS2Widget> allWidgets = getWidgets().getAll();
        RS2Widget storedWidget = allWidgets.stream().filter(w -> w.getWidth() == 62 && w.getHeight() == 62 && w.getItemId() == 62).findFirst().orElse(null);
        return storedWidget;
    }

    private boolean isVisible() {
        return getFletchingMenu() != null && getFletchingMenu().isVisible();
    }

Any feedback is welcome :D

Link to comment
Share on other sites

2 hours ago, Malcolm said:

    private RS2Widget getFletchingMenu() {
        final List<RS2Widget> allWidgets = getWidgets().getAll();
        final RS2Widget storedWidget = allWidgets.stream().filter(w -> w.getWidth() == 62 && w.getHeight() == 62 && w.getItemId() == 62).findFirst().orElse(null);
        return storedWidget;
    }

    private boolean isVisible() {
        final RS2Widget wid = getFletchingMenu();
        return wid != null && wid.isVisible();
    }

Don't need to call getFletchingMenu() more than once in the isVisible() boolean :doge:

 

Oh yeah, but this does not answer the question about using item ID as filter

Link to comment
Share on other sites

7 hours ago, Malcolm said:

Sorry, I was just going off of this quote :doge:

"Any feedback is welcome"

 

In general for ID's and widgets, you're allowed to use root widgets and you're allowed to pull lists from sprites/actions/colors, etc but anything that is a child widget isn't allowed.

So as long as it's not a child widget you should be good :boge:

Such a savage you are. Much appreciated are you :doge:

Anyways, thank you for pointing me towards the right direction. I am a complete noob with Bot scripting and new to Java in general. Luckily I use curly brackets the non retarded way.

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