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

Check if user is in clan.

Featured Replies

Does someone have this to check if your bot is in a clan and if not it will join a clan.

open clan chat tab
if widget (589,0) is visible and text contains "Not in chat" then click join chat and enter chat name
else we're in a chat

I made a little class that will hopefully deal with this ( not properly tested )

import org.osbot.rs07.api.ui.RS2Widget;
import org.osbot.rs07.api.ui.Tab;
import org.osbot.rs07.script.Script;

import java.util.Random;

public class ClanChatter{

    private Script script;

    public ClanChatter(Script script){
        this.script = script;
    }

    public boolean notInClanChat(){
        RS2Widget notInChat = script.getWidgets().getWidgetContainingText("Not in chat");
        return (notInChat != null && notInChat.isVisible());
    }

    public void openClanChatTab(){
        script.getTabs().open(Tab.CLANCHAT);
    }

    public boolean isClanChatTabOpen(){
        return Tab.CLANCHAT.isOpen(script.getBot());
    }

    public boolean isInClanChat(){
        RS2Widget talkingIn = script.getWidgets().getWidgetContainingText("Talking in:");
        return (talkingIn != null && talkingIn.isVisible() && !talkingIn.getMessage().contains("Not in chat"));
    }

    public void joinClanChat(String name){

        //RS2Widget enterName = getWidgets().getWidgetContainingText("Enter the player name whose channel you wish to join:");
        RS2Widget enterName = script.getWidgets().get(162, 32);
        RS2Widget joinChat = script.getWidgets().getWidgetContainingText("Join Chat");

        if (enterName != null && enterName.isVisible()){
            script.getKeyboard().typeString(name);
            sleep(4000, 5000);
        }
        else if (joinChat != null && joinChat.isVisible()) clickOnWidget(joinChat);
    }

    public void leaveClanChat(){
        RS2Widget leaveWidget = script.getWidgets().getWidgetContainingText("Leave Chat");
        if (leaveWidget != null && leaveWidget.isVisible()) clickOnWidget(leaveWidget);
    }

    public boolean isInClan(String name){
       RS2Widget talkingIn = script.getWidgets().getWidgetContainingText("Talking in:");
       return talkingIn.getMessage().contains(name);
    }

    public boolean isOwner(String name){
       RS2Widget owner = script.getWidgets().getWidgetContainingText("Owner:");
       return owner.getMessage().contains(name);
    }

    public void talkInClanChat(String output){
        script.getKeyboard().typeString(String.format("/%s", output));
        sleep(1500, 2000);
    }

    private void clickOnWidget(RS2Widget widget){
        widget.hover();
        script.getMouse().click(false);
        sleep(1500, 2000);
    }

    private void sleep(int min, int max){

        try{
            script.sleep(new Random().nextInt(max-min) + min);
        } catch(Exception e){
            script.log(e);
        }
    }
}

Edited by Explv

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

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.