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.

AntiBan Class

Featured Replies

I haven't been able to test anything, as I wrote this while the client is currently down. It works based on a weight system. Each action has a specific weight. The higher the weight, the more likely that action is to be performed. I only made 3 actions, but it's very simple to implement your own. Feedback is welcome. 

Adding your own action:

Say you want to add an action to...check your woodcutting exp. You would add to the Action enum constants the name of the action and the default weight, like such:

public enum Action {
    MOVE_MOUSE(3),
    ROTATE_CAMERA(7),
    RIGHT_CLICK_RANDOM_OBJECT(1),
    CHECK_WC_EXP(60); // <---------

    int weight;

    Action(int weight) {
        this.weight = weight;
    }

    public int getWeight() {
        return weight;
    }

    public void setWeight(int weight) {
        this.weight = weight;
    }
}

Then you would add your method that performs the action to the switch statement in the execute() method, like so:

switch (action) {
    case MOVE_MOUSE:
        script.log("[ANTI BAN:] Moving mouse.");
        moveMouseRandomly();
        break;
    case ROTATE_CAMERA:
	    script.log("[ANTI BAN:] Rotating camera.");
	    rotateCameraRandomly();
	    break;
    case RIGHT_CLICK_RANDOM_OBJECT:
	    script.log("[ANTI BAN:] Right-clicking an object");
	    rightClickRandomObject();
	    break;
    case CHECK_WC_EXP:
	    script.log("[ANTI BAN:] Good luck JAGEX");
	    checkWcExp();
	    break;
}

 

Basic usage:

import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

@ScriptManifest(author = "", info = "", logo = "", name = "Test", version = 0.1)
public class Test extends Script {
    
    AntiBan antiban = new AntiBan(this, 30000, 180000);

    @Override
    public int onLoop() throws InterruptedException {
        
        if (antiban.shouldExecute()) {
            antiban.execute();
        }
        
        return 500;
    }

}

Using a custom action list:

import java.util.ArrayList;
import java.util.List;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import test.AntiBan.Action;

@ScriptManifest(author = "", info = "", logo = "", name = "Test", version = 0.1)
public class Test extends Script {
    
    AntiBan antiban;

    @Override
    public void onStart() {

        List<Action> actionList = new ArrayList<>();
        
        // create an action with default weight
        Action action1 = Action.MOVE_MOUSE;
        
        // create an action and change its weight
        Action action2 = Action.ROTATE_CAMERA;
        action2.setWeight(20);
        
        // add actions to list
        actionList.add(action1);
        actionList.add(action2);
        
        // create antiban object with custom action list
        antiban = new AntiBan(this, 30000, 180000, actionList);
    }

    @Override
    public int onLoop() throws InterruptedException {

        if (antiban.shouldExecute()) {
            antiban.execute();
        }

        return 500;
    }

}

Source:

Spoiler

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import org.osbot.rs07.api.model.RS2Object;
import static org.osbot.rs07.script.MethodProvider.random;
import org.osbot.rs07.script.Script;

public class AntiBan {

    private final Script script;

    private int minActionBound = 0; // minimum time between actions
    private int maxActionBound = 0; // maximum time between actions
    private long nextExecuteTime;

    private List<Action> defaultActions = Arrays.asList(Action.values());

    List<Action> actionList = new ArrayList<>();

    /**
     * Creates the object with all default actions to be performed.
     *
     * @param script script reference
     * @param minActionBound minimum delay between anti ban actions
     * @param maxActionBound maximum delay between anti ban actions
     */
    public AntiBan(Script script, int minActionBound, int maxActionBound) {
        this(script, minActionBound, maxActionBound, Arrays.asList(Action.values()));
    }

    /**
     * Actions must be added manually.
     *
     * @param script script reference
     * @param minActionBound minimum delay between anti ban actions
     * @param maxActionBound maximum delay between anti ban actions
     * @param actions the actions that should be performed
     */
    public AntiBan(Script script, int minActionBound, int maxActionBound, List<Action> actions) {
        this.script = script;
        this.minActionBound = minActionBound;
        this.maxActionBound = maxActionBound;
        nextExecuteTime = System.currentTimeMillis() + random(minActionBound, maxActionBound);
        actionList = actions;
    }

    /**
     * @return true if it's time to perform an action
     */
    public boolean shouldExecute() {
        return (System.currentTimeMillis() > nextExecuteTime);
    }

    public long getNextExecuteTime() {
        return nextExecuteTime;
    }

    /**
     * Performs a random action from the action list based off of the weighted
     * values.
     *
     * How it works: Creates an array the size of the cumulative weight
     * of the action list and then loops through the action list assigning each
     * index the value of the enum value. Then chooses a random number
     * 0-arrayLength to get the action to perform.
     */
    public void execute() {
        if (actionList.size() > 0) {
            // calcualte the cumulative weight of the action list
            int cumulativeWeight = 0;
            for (Action action : actionList) {
                cumulativeWeight += action.getWeight();
            }

            // for every action in the action list, add one slot to wheel per weight
            int[] wheel = new int[cumulativeWeight];
            int index = 0; // keep track of last index

            for (int i = 0; i < actionList.size(); i++) {
                int numSlots = actionList.get(i).getWeight();
                while (numSlots-- > 0) {
                    wheel[index++] = actionList.get(i).ordinal();
                }
            }

            // get an action from a random slot
            int actionOrdinal = wheel[random(0, wheel.length) - 1];
            Action action = Action.values()[actionOrdinal];

            // perform the action
            switch (action) {
                case MOVE_MOUSE:
                    script.log("[ANTI BAN:] Moving mouse.");
                    moveMouseRandomly();
                    break;
                case ROTATE_CAMERA:
                    script.log("[ANTI BAN:] Rotating camera.");
                    rotateCameraRandomly();
                    break;
                case RIGHT_CLICK_RANDOM_OBJECT:
                    script.log("[ANTI BAN:] Right-clicking an object");
                    rightClickRandomObject();
                    break;
            }

            // set the next execute time
            nextExecuteTime = System.currentTimeMillis() + random(minActionBound, maxActionBound);
        }
    }

    public void addAction(Action a) {
        actionList.add(a);
    }

    /**
     * @param a the action to add
     * @param weight likeliness of this action to be performed
     */
    public void addAction(Action a, int weight) {
        Action action = a;
        action.setWeight(weight);
        actionList.add(action);
    }

    /**
     * Adds an occurrence of all Actions to the action list
     */
    public void addAllActions() {
        actionList = defaultActions;
    }

    public void clearActions() {
        actionList.clear();
    }

    /**
     * Each action is weighted. Meaning the higher the weight, the more likely
     * that action is to be performed. If two actions have the same weight, they
     * are equally likely to be performed.<br><br>
     *
     *
     * Default weights<br>
     * ------------------------<br>
     * Move mouse: 3<br>
     * Rotate camera: 7<br>
     * Right click object: 1
     */
    public enum Action {
        MOVE_MOUSE(3),
        ROTATE_CAMERA(7),
        RIGHT_CLICK_RANDOM_OBJECT(1);

        int weight;

        Action(int weight) {
            this.weight = weight;
        }

        public int getWeight() {
            return weight;
        }

        public void setWeight(int weight) {
            this.weight = weight;
        }
    }

    /////////////////////////////
    //     Helper methods      //
    /////////////////////////////
    private void moveMouse() {
        script.getMouse().move(random(43, 538), random(47, 396));
    }

    /////////////////////////////
    //  Methods for execution  //
    /////////////////////////////
    public void moveMouseRandomly() {
        script.getMouse().move(random(43, 538), random(47, 396));
    }

    public void rotateCameraRandomly() {
        script.getCamera().movePitch(random(script.getCamera().getLowestPitchAngle(), 67));
        script.getCamera().moveYaw(random(0, 359));
    }

    /**
     * Right clicks a random visible object and then moves mouse to close the
     * menu.
     */
    public void rightClickRandomObject() {
        List<RS2Object> visibleObjs = script.getObjects().getAll().stream().filter(o -> o.isVisible()).collect(Collectors.toList());

        // select a random object
        int index = random(0, visibleObjs.size() - 1);
        RS2Object obj = visibleObjs.get(index);

        if (obj != null) {
            // hover the object and right click
            obj.hover();
            script.getMouse().click(true);

            // while the menu is still open, move the mouse to a new location
            while (script.getMenuAPI().isOpen()) {
                moveMouse();
            }
        }
    }

}

 

 

Edited by Deathiminent
source code edits

i hope this is a meme cuz wow this makes me sad hbu @Alek

 

 

this is legit a fuckin meme right

Edited by Raccoon Hunter

why do everybody check wc exp .. whats that all about .. is that a bot meme?

 

Edited by trapmanjay

4 minutes ago, trapmanjay said:

why do everybody check wc exp .. whats that all about .. is that a bot meme?

 

It's the one secret to bypass Jagex's anti ban system, didn't you know?

  • Author
7 minutes ago, Raccoon Hunter said:

i hope this is a meme cuz wow this makes me sad hbu @Alek

 

 

this is legit a fuckin meme right

Kinda is kinda isn't. Most people who request scripts seem to have "anti ban" as a requirement.

1 minute ago, Deathiminent said:

Kinda is kinda isn't. Most people who request scripts seem to have "anti ban" as a requirement.

well then tell them the truth, even alek said antiban is shit

 

good antiban is writing a good script

  • Author
4 minutes ago, Raccoon Hunter said:

well then tell them the truth, even alek said antiban is shit

 

good antiban is writing a good script

Well, it's not "truth", as we don't have any proof that anti ban is useless. Everyone has their own beliefs about it. I personally don't think it matters, but if someone is paying me to write a script for them and anti ban implementation is one of their specifications, then I'll add it.

28 minutes ago, Raccoon Hunter said:

well then tell them the truth, even alek said antiban is shit

 

good antiban is writing a good script

define "good script"

5 hours ago, trapmanjay said:

define "good script"

Well written, concise, and fit for purpose.

Ideally, 10 years from now when your script eventually breaks, one of the devs (whoever that is) should be able to pick up and fix your script easily. 

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.