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.

Pest Control Script

Featured Replies

Hi!

Today I remembered void armour was a thing, so I made this; it works well and as intended - around 350 points gained so far between testing and actually running.

In a nutshell:

  1. it will cross the nearest gangplank (that way you can use it on any of the boat levels)
  2. it will wait until the game starts
  3. when the game starts, it will click between 14-18 tiles south (because the PC map's coords change constantly)
  4. it will stay around the void knight and kill any enemies within a specified radius
  5. it will constantly 1 tick prayer flick (so you never take too much damage and you always get boosts)
  6. rinse and repeat

Feel free to use as-is, copyfor your own projects, or suggest improvements! :)<3

@ScriptManifest(info = "", logo = "", name = "Pest Control", author = "Marcus", version = 1.0)
public class pestControl extends Script {

    private InvokeHelper invokeHelper;
    private Position ATTACK_ZONE_POSITION;
    private boolean gameStarted = false;

    public void onStart() throws InterruptedException {
        super.onStart();
        invokeHelper = new InvokeHelper(this);
        log("Bot Started!");
    }

    @Override
    public int onLoop() {
        if (!isInGame()) {
            gameStarted = false; 
            if (!isInBoat()) {
                crossGangplank();
            }
        } else {
            if (!gameStarted) {
                setAttackZonePosition();
                gameStarted = true; 
            }
            if (shouldGoToAttackZone()) {
                goToAttackZone();
            } else {
                attackNearbyNPC();
            }
        }
        return random(200, 300);
    }

    @Override
    public void onGameTick() {
        super.onGameTick();
        
        RS2Widget quickPrayerWidget = getQuickPrayerWidget();

        if (quickPrayerWidget == null) {
            return;
        }
        
        if (getPrayer().isQuickPrayerActive()) {
            invokeHelper.invoke(quickPrayerWidget, 0);
            invokeHelper.invoke(quickPrayerWidget, 0);
        } else {
            invokeHelper.invoke(quickPrayerWidget, 0);
        }
    }

    private RS2Widget getQuickPrayerWidget() {
        return getWidgets().get(160, 19); 
    }

    private boolean isInGame() {
        RS2Widget gameWidget = getWidgets().get(408, 5);
        return gameWidget != null && gameWidget.isVisible();
    }

    private boolean isInBoat() {
        RS2Widget boatWidget = getWidgets().get(407, 4);
        return boatWidget != null && boatWidget.isVisible();
    }

    private void crossGangplank() {
        RS2Object gangplank = getObjects().closest("Gangplank");
        if (gangplank != null && gangplank.interact("Cross")) {
            Sleep.until(() -> isInBoat(), 5000);
            if (isInBoat()) {
                log("Waiting for the game to start...");
                Sleep.until(() -> isInGame(), 5000); 
            }
        }
    }

    private void setAttackZonePosition() {
        Position playerStartPosition = myPosition();
        if (playerStartPosition != null) {
            ATTACK_ZONE_POSITION = new Position(playerStartPosition.getX(), playerStartPosition.getY() - (random(14,18)), 0);
            log("Attack zone position set to: " + ATTACK_ZONE_POSITION);
        }
    }

    private boolean shouldGoToAttackZone() {
        return ATTACK_ZONE_POSITION != null && myPlayer().getPosition().distance(ATTACK_ZONE_POSITION) > 7;
    }

    private void goToAttackZone() {
        if (!myPlayer().isAnimating() && !myPlayer().isMoving()) {
            log("Running to the attack zone at position: " + ATTACK_ZONE_POSITION);
            getWalking().walk(ATTACK_ZONE_POSITION);
            Sleep.until(() -> myPlayer().getPosition().distance(ATTACK_ZONE_POSITION) <= 7, 10000);
        } else {
            log("Player is moving...");
        }
    }

    private void attackNearbyNPC() {
        NPC target = getNpcs().closest(npc ->
                npc != null && npc.exists() && npc.hasAction("Attack") &&
                getMap().canReach(npc) && isNearAttackZone(npc)
        );

        if (target != null) {
            log("Attacking NPC: " + target.getName());
            if (invokeHelper.invoke(target, "Attack")) {
                Sleep.until(() -> myPlayer().isAnimating() || myPlayer().isUnderAttack(), 1000);
            }
        } else {
            log("No suitable NPC found.");
        }
    }

    private boolean isNearAttackZone(NPC npc) {
        return npc != null && ATTACK_ZONE_POSITION != null && ATTACK_ZONE_POSITION.distance(npc.getPosition()) < 7;
    }

    @Override
    public void onExit() {
        log("Bot Stopped!");
    }
}

 

  • Author
46 minutes ago, Czar said:

Nice! :D Scripter rank when? xD

Thank you, I appreciate that! 😛 Likely never, my motivation to play tends to come and go :(

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.