Jump to content

Scriptwise antiban measures


nzb96

Recommended Posts

Posted (edited)

Hi

 

I just made my first script, I used it for like an hour or two with breaks, next day it was banned.

I wanted to ask what are the most obvious things I screwed up in the script.

For context, the account was created ~ 2years ago, it was about 300 total and f2p, I did play manually on it till this point (2 years ago) It was fishing trouts in lumbridge. I used built in breaks ~ 15-50 min of botting with 5-20 min breaks.

Used stealth client, on mac with java17 in case it makes any difference 😉

My thoughts are that I probably should avoid some parts of api, and somehow implement my own mouse movement patterns, but dunno whether it is valid ideas.

Let's ignore the code quality I am not java dev ;-;

import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.model.Item;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.Condition;
import org.osbot.rs07.utility.ConditionalSleep;

import java.util.Arrays;
import java.util.stream.IntStream;


@ScriptManifest(author = "Nzb", info = "Lumbridge trout fisher", logo = "", name = "Lumbridge Fisher", version = 1)
public class Fisher extends Script {
    static final String[] SUPPORTED_FISHES = {"Raw trout", "Raw salmon"};
    private final Area fishArea = new Area(3238, 3255, 3242, 3235);


    @Override
    public void onStart() throws InterruptedException {
        checkPreconditions();
        setUpInventory();
        log(getInventory().getSlotBoundingBox(0));

    }

    @Override
    public int onLoop() throws InterruptedException {

        if (!fishArea.contains(myPlayer())) {
            walkToFishingSpot();
        } else {
            fishTrouts();
        }
        return 0;
    }

    private void walkToFishingSpot() {
        if (getWalking().webWalk(fishArea)) {
            new ConditionalSleep(random(1542, 2534), random(5129, 7412)) {
                @Override
                public boolean condition() {
                    return fishArea.contains(myPlayer());
                }

            }.sleep();
        }
    }

    private void fishTrouts() throws InterruptedException {
        if (getInventory().isFull()) {
            sleep(random(500, 6000));
            dropFish();
        }
        if (!myPlayer().isAnimating()) {
            NPC fishingSpot = getNpcs().closest("Rod Fishing Spot");
            fishingSpot.interact("lure");
            getMouse().moveOutsideScreen();
            sleep(random(2421, 6521));
        }


    }

    private void dropFish() throws InterruptedException {
        int[] slotsWithFish = IntStream.rangeClosed(0, 25).toArray();
        if (getSettings().isShiftDropActive()) getKeyboard().pressKey(16);
        for (int slotId : slotsWithFish) {
            log(slotId);
            Item item = getInventory().getItemInSlot(slotId);
            if (item != null) {
                log(item.getName());
                if (Arrays.asList(SUPPORTED_FISHES).contains(item.getName())) {
                    if (getSettings().isShiftDropActive()) {
                        item.interact();
                    }

                }
                sleep(random(1052, 1370));
            }
        }
        if (getSettings().isShiftDropActive()) getKeyboard().releaseKey(16);

    }

    private void checkPreconditions() {
        if (!getInventory().containsAll("Feather", "Fly fishing rod")) {
            stop();
        }
    }

    private void setUpInventory() {
        int featherPosition = getInventory().getSlot("Feather");
        int rodPosition = getInventory().getSlot("Fly fishing rod");

        if (featherPosition != 26 & rodPosition != 27) {
            moveItemInSlot(featherPosition, 26);
            moveItemInSlot(rodPosition, 27);
        }
    }

    private void moveItemInSlot(int startSlot, final int endSlot) {
        if (getInventory().isItemSelected()) {
            getInventory().deselectItem();
        }
        getMouse().continualClick(getInventory().getMouseDestination(startSlot), new Condition() {
            @Override
            public boolean evaluate() {
                getMouse().move(getInventory().getMouseDestination(endSlot), true);
                return getInventory().getMouseDestination(endSlot).getBoundingBox().contains(getMouse().getPosition());
            }
        });
    }


}

 

Edited by nzb96
Link to comment
Share on other sites

Posted (edited)

For a fishing script I do the following. 
I generate a gaussian mean and std dev at script start. 


- AFK when fishing (mouse offscreen) + AFK afterwards for a gaussian random amount of time.

- Drop fish even if inventory is nearly full after afking

- Random shift click drop orders (ex: snake left/right, snake up down, ect...)

F2p is just high ban rate. Pretty sure there are tons of false positives too. 

Edited by yfoo
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...