Skip 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.

Man pickpocket suicider source

Featured Replies

Some code I toyed around with yesterday to test out a few things:

 

Core:

import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

import java.util.Comparator;
import java.util.function.Predicate;
import java.util.stream.Stream;

@ScriptManifest(author = "Botre", info = "", logo = "", name = "Experiment", version = 0.0)

public class ExperimentalScript extends Script {

    private ScriptClock clock = new ScriptClock(1.6);

    private String name = "Man";

    private String action = "Pickpocket";

    private Predicate<NPC> validityPredicate = o -> o != null && o.exists() && o.getName().equals(name) && o.hasAction(action) && getMap().canReach(o.getPosition());

    private Comparator<Entity> distanceComparator = EntityComparator.create(this, EntityComparator.Type.DISTANCE_FROM_PLAYER);

    private Target<NPC> target = new Target<>(validityPredicate, () -> getNpcStream().filter(validityPredicate).min(distanceComparator));

    @Override
    public int onLoop() throws InterruptedException {
        if (target.valid() || target.find()) {
            target.get().interact(action);
        }
        return clock.tick();
    }

    private Stream<RS2Object> getObjectStream() {
        return getObjects().getAll().stream();
    }

    private Stream<NPC> getNpcStream() {
        return getNpcs().getAll().stream();
    }

}

Target:

import java.util.Optional;
import java.util.function.Predicate;

/**
 * Created by Bjorn on 19/07/2015.
 */
public class Target<T> {

    private T target;
    private TargetSearcher<T> searcher;
    private Predicate<T> validity;

    public Target(Predicate<T> validity, TargetSearcher<T> searcher) {
        this.validity = validity;
        this.searcher = searcher;
    }

    /**
     * @return The current target.
     */
    public T get() {
        return target;
    }

    /**
     * @return Whether the current target is valid.
     */
    public boolean valid() {
        if (validity.test(target)) {
            return true;
        } else {
            target = null;
            return false;
        }
    }

    /**
     * Searches for and assigns a new target by making a call to the search() method.
     *
     * @return Whether a new target was find.
     */
    public boolean find() {
        Optional<T> optional = searcher.search();
        if (optional.isPresent()) {
            target = optional.get();
            return true;
        } else {
            return false;
        }
    }

}

Target searcher:

import java.util.Optional;

/**
 * Created by Bjorn on 21/07/2015.
 */
public interface TargetSearcher<T> {

    /**
     * Searches for a new target.
     *
     * @return The new target.
     */
    Optional<T> search();

}

Script clock:

/**
 * Created by Bjorn on 19/07/2015.
 */
public class ScriptClock {

    private double loopsPerSecond ;
    private int millisecondsPerLoop;
    private long systemMilliseconds;
    private long deltaMilliseconds;
    private int sleepMilliseconds;

    public ScriptClock(double loopsPerSecond) {
        this.loopsPerSecond = loopsPerSecond;
        millisecondsPerLoop = (int) ((1 / loopsPerSecond) * 1000);
        systemMilliseconds = System.currentTimeMillis();
    }

    public int tick() {
        deltaMilliseconds = System.currentTimeMillis() - systemMilliseconds;
        systemMilliseconds = System.currentTimeMillis();
        sleepMilliseconds = (int) (millisecondsPerLoop - deltaMilliseconds);
        return sleepMilliseconds > 0 ? sleepMilliseconds : 0;
    }

}

Entity comparator:

import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.script.MethodProvider;

import java.util.Comparator;

/**
 * Created by Bjorn on 20/07/2015.
 */
public final class EntityComparator {

    public enum Type {
        DISTANCE_FROM_PLAYER,
    }

    public static Comparator<Entity> create(MethodProvider mp, Type type) {
        switch(type) {
            case DISTANCE_FROM_PLAYER: return (a, b) -> mp.getMap().distance(a.getPosition()) - mp.getMap().distance(b.getPosition());
        }
        return null;
    }

}

this gets you 1-50 thieving in 1 night if its fast enough. use this for your DT lads

this gets you 1-50 thieving in 1 night if its fast enough. use this for your DT lads

sounds good :)

You could have uploaded this to github so people can download a zip instead of copy and pasting every file. 

Just a suggestion. :p

You could have uploaded this to github so people can download a zip instead of copy and pasting every file. 

Just a suggestion. tongue.png

 

They getting a free script source they can spend the effort copying it :doge:

  • Author

You could have uploaded this to github so people can download a zip instead of copy and pasting every file. 

Just a suggestion. tongue.png

 

Meh I might when my noob-friendly framework is ready :x

Nice man

  • Author

You're running me out of business here :'(

Looks good though! Remember that map.distance() is deprecated though smile.png

 

Sowyyy, tbh I don't think many people even know how to compile this so dw :p

 

I think it was just getMap().distance(Entity) that was deprecated, getMap().distance(Entity.getPosition()); hasn't been touched (yn).

Sowyyy, tbh I don't think many people even know how to compile this so dw tongue.png

 

I think it was just getMap().distance(Entity) that was deprecated, getMap().distance(Entity.getPosition()); hasn't been touched (yn).

 

I have no idea lol, I've never touched those functions :p better be safe than sorry!

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.