Jump to content

Identifying whether or not a player is on your friends list


Alakazizam

Recommended Posts

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