Jump to content

Identifying whether or not a player is on your friends list


Recommended Posts

Posted (edited)

I got a method down for making an array of friends on your friends list. I run this on start for a muling script. Apparently even if your trade settings are set to friends only, osbot still sees other people trying to trade you even though the runescape client doesn't display the trade. I run this onStart so adding friends after the script has started will not add them to the list.

Wanted to share the code I used to help anyone trying to do the same thing and any advice on how to improve it is more than welcome.

 

	String Friends[];




	void GetFriendsList() {
        tabs.open(Tab.FRIENDS);
        for (RS2Widget Wid : getWidgets().get(429,11).getChildWidgets()) {
            String Name = Wid.getMessage();
            Name.replaceAll(" ", "\\u00a0");
            if (!Name.contains("Offline") && !Name.contains("<col=ffff00>") && Name != "") {
                log("Adding friend: " + Name);
                if (Friends != null) {
                    Friends = AddName(Friends.length, Friends, Name);
                } else {
                    Friends = new String[]{Name};
                }
            }
        }
        log("finished adding friends. Friends are : " + Arrays.toString(Friends));
    }




    String[] AddName(int n, String arr[], String x)
    {
        int i;
        String newarr[] = new String[n + 1];
        for (i = 0; i < n; i++)
            newarr[i] = arr[i];
        newarr[n] = x;
        return newarr;
    }



 

Edited by Alakazizam

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