Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • RandomEvent based anti ban framework


    Dorkinator

    Recommended Posts

    This code allows you to have random events that can easily be implemented into multiple scripts. Also the constructor for the AbstractAntiBan object does per player profiles so each player will automatically get a different and unique antiban profile.

    Credit to Dinh for telling me that using RandomEven.BANK_PIN to initialize the RandomSolver doesn't work and break does.

    package util;
    
    import node.Node;
    import org.dreambot.api.methods.MethodContext;
    import random.Random;
    import random.RandomConstant;
    
    /**
     * Created by Dorkinator on 6/22/2017.
     */
    public abstract class AbstractAntiBan extends Node<MethodContext> {
    	protected MethodContext c;
    	private long nextActivation;
    	private RandomConstant canActivate;
    	private RandomConstant activate;
    	private RandomConstant range;
    	private int likelyhood;
    	public AbstractAntiBan(MethodContext c, int mindelay, int maxDelay, int minRange, int maxRange, int likelyhood) {
    		super(c);
    		this.c = c;
    		this.likelyhood = likelyhood;
    		this.canActivate = new RandomConstant("canActivate"+status(), c.getClient().getUsername(),0, 100, 60*60*1000);
    		this.activate = new RandomConstant("activate"+status(), c.getClient().getUsername(),mindelay, maxDelay, 60*60*1000);
    		this.range = new RandomConstant("range"+status(), c.getClient().getUsername(),minRange, maxRange, 60*60*1000);
    		nextActivation = getNextActivation();
    	}
    
    	@Override
    	public void execute() {
    		nextActivation = getNextActivation();
    		onExecute();
    	}
    
    	@Override
    	public boolean activate() {
    		return canActivate.get() > likelyhood && System.currentTimeMillis() > nextActivation;
    	}
    
    	public abstract void onExecute();
    
    	private long getNextActivation(){
    		return System.currentTimeMillis()+Random.nextInt(activate.get(), activate.get()+range.get());
    	}
    }
    
    
    package main;
    
    import antibans.*;
    import org.dreambot.api.methods.MethodContext;
    import org.dreambot.api.randoms.RandomEvent;
    import org.dreambot.api.randoms.RandomSolver;
    import org.dreambot.api.script.AbstractScript;
    import util.AbstractAntiBan;
    
    import java.awt.*;
    import java.util.ArrayList;
    
    /**
     * Created by Dorkinator on 6/22/2017.
     */
    public class AntiBan extends RandomSolver{
    	private ArrayList<AbstractAntiBan> antibans;
    	private AbstractAntiBan currentAnti;
    
    	@Override
    	public void onPaint(Graphics g) {
    
    	}
    
    	public AntiBan(MethodContext c) {
    		super(RandomEvent.BREAK, c);
    		antibans = new ArrayList<>();
    		antibans.add(new TurnCamera(c));
    	}
    
    	@Override
    	public boolean shouldExecute() {
    		for(AbstractAntiBan i:antibans){
    			if(i.activate()){
    				currentAnti = i;
    				System.out.println(i.status());
    				return true;
    			}
    		}
    		return false;
    	}
    
    	@Override
    	public int onLoop() {
    		if(currentAnti != null){
    			currentAnti.execute();
    			System.out.println("executed");
    		}else{
    			System.out.println("Antiban failed to activate");
    		}
    		return -1;
    	}
    }
    
    
    Link to comment
    Share on other sites

    • 3 months later...
    • 2 weeks later...

    How would you implement this into a script?

    Extend AbstractAntiBan which forces you to Overwrite onExecute, then add that class to the ArrayList in AntiBan?

    Link to comment
    Share on other sites

    • 1 year later...

    Yo, this was the resource I needed. Thank you man! 

     

    That said, do you think bans can be avoided at the scripting level at this point, or is there no hope given Jagex's detection algorithms? I just had a couple of accounts banned while testing out scripts that I wrote, trying to understand whether or not I have false hope. 

     

    What are your thoughts?

     

    -Pash

     

    PS Find free bot scripts and source code in my repo

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.