Skip to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Friends List control

Featured Replies

Hey, just wrote a few methods to control your friends list so thought to share.

RandomSleep(); // Your sleeping methods

    private void AddFriend(String name) throws InterruptedException
    {
        if(tabs.getOpen() != Tab.FRIENDS)
        {
            tabs.open(Tab.FRIENDS);
            RandomSleep();
        }

        if(IsFriend(name)) return;

        RS2Widget widget = widgets.get(429, 7);
        if(widget == null) return;

        if(widget.isVisible()) widget.interact();
        RandomSleep();

        widget = widgets.get(162, 33);
        if(widget != null && widget.isVisible())
        {
            keyboard.typeString(name);
            keyboard.pressKey(13);
        }
    }

    private boolean RemoveFriend(String name) throws InterruptedException
    {
        if(tabs.getOpen() != Tab.FRIENDS)
        {
            tabs.open(Tab.FRIENDS);
            RandomSleep();
        }

        if(!IsFriend(name)) return false;

        RS2Widget widget = widgets.get(429, 3);
        if(widget == null) return false;

        RS2Widget[] friends;
        if((friends = widget.getChildWidgets()) != null)
        {
            for(RS2Widget w : friends)
            {
                if(w.getMessage().equals(name) && w.isVisible())
                    return w.interact("Delete");
            }
        }

        return false;
    }

    private void MessageFriend(String name, String message) throws InterruptedException
    {
        if(tabs.getOpen() != Tab.FRIENDS)
        {
            tabs.open(Tab.FRIENDS);
            RandomSleep();
        }

        RS2Widget widget = widgets.get(429, 3);
        if(widget == null) return;

        RS2Widget[] friends;
        if((friends = widget.getChildWidgets()) == null)
            return;


        for(RS2Widget w : friends)
        {
            if(w.getMessage().equals(name) && w.isVisible())
                w.interact("Message");
        }
        RandomSleep();


        widget = widgets.get(162, 33);
        if(widget != null && widget.isVisible())
        {
            keyboard.typeString(message);
            keyboard.pressKey(13);
        }
    }

    private boolean IsFriend(String name)
    {
        RS2Widget widget = widgets.get(429, 3);
        if(widget == null) return false;

        RS2Widget[] friends;
        if((friends =  widget.getChildWidgets()) != null)
        {
            for(RS2Widget w : friends)
            {
                if(w.getMessage().equals(name))
                    return true;
            }
        }

        return false;
    }

    private boolean IsFriendOnline(String name)
    {
        if(!IsFriend(name)) return false;

        RS2Widget widget = widgets.get(429, 3);
        if(widget == null) return false;

        RS2Widget[] friends;
        int child = 0;

        if((friends = widget.getChildWidgets()) != null)
        {
            for(RS2Widget w : friends)
            {
                if(w.getMessage().equals(name))
                    return (!friends[child + 1].getMessage().equals("Offline"));

                child++;
            }
        }

        return false;
    }

Edited by Aeonx

  • Author

Great code! Might be using this in the future.

 

Thanks! I'm adding Remove friend later as well ;)

  • Author

Ok I rewrote the whole API as previous one was pretty much a dev. version.

 

Added Remove Friend method and pretty much fixed all the possible bugs and so it's reliable. Enjoy :)

 

 

  • 3 months later...

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.