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.

What to do what to see

Featured Replies

Wanted to introduce myself, you can call me skid.

I think I found my new hobby! I am sitting here enjoying some nice scotch watching my script kill cows.

This weekend I finally gave in to all these ads about being able to play runescape on mobile. Having played runescape extensively in middle school I couldn't help but give in to the nostalgia and played through tutorial island on my phone.

After a while I said hell I will just play a bit and started playing on my computer. Then I thought, well hell why not play multiple accounts at a time to keep my mind stimulated. Fast forward and I am playing four accounts at once while listening to podcast. I thought again, why not automate this so I started googling and came across this community. A little reading of OSBot's API and lurking this forum for code examples and I was on my way!

Full disclosure, I have been a self-taught software engineer for the last three years or so and just started picking up Java as part of a new job so it didn't take a lot to come up with something that worked. What's the best way to get involved around here? I love the OSBot and just bought VIP so I can start running multiple bots at a time. I'd love to read some of people's more advanced scripts that they don't mind having open-sourced.

Here's my first script! It went through a few revisions. I am still trying to understand how to best organize code around OSBot's API.

public class CowKiller {
    private MethodProvider B;
    private String[] advesaryStrings = { "Cow", "Cow calf" };

    public CowKiller(MethodProvider B) {
        this.B = B;
    }

    public void execute() throws InterruptedException {
        while(lifeSafe()) {
            if (B.getSettings().getRunEnergy() > 20) {
                run();
            }
            NPC advesary = getAdvesary();
            attack(advesary);
        }
        run();
        B.getWalking().walk(Banks.LUMBRIDGE_LOWER);
    }

    private void attack(NPC advesary) throws InterruptedException {
        B.log("Attacking advesary!!!!!!!!!!!!!!");
        while(attackCondition(advesary) && lifeSafe()) {
            B.log("attacking the cow");
            advesary.interact("Attack");
            B.sleep(B.random(1000, 5000));
        }
    }

    private NPC getAdvesary() {
        return B.getNpcs().closest(npc -> attackable(npc));
    }

    private boolean attackable(NPC advesary) {
        return wantedAdvesary(advesary) &&
                advesary.getInteracting() == null &&
                !advesary.isUnderAttack() &&
                !advesary.isHitBarVisible() &&
                B.getMap().canReach(advesary);
    }

    private boolean lifeSafe() {
        return B.skills.getDynamic(Skill.HITPOINTS) > 10;
    }

    private boolean attackCondition(NPC advesary) {
        return advesary.exists() && advesary.isAttackable();
    }

    private void run() {
        B.getSettings().setRunning(true);
    }

    private boolean wantedAdvesary(NPC advesary) {
        for (String advesaryString : advesaryStrings) {
            if (advesary.getName().equals(advesaryString)) {
                return true;
            }
        }
        return false;
    }
}

I think that's enough for an introduction, cheers!

Hey mate welcome!

I quickly went through the script & can tell you went through the API but the base of your script is not right.

 

Read this, it should help a lot with what you're trying to achieve!

Hybris

  • 2 months later...

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.