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.

Thieving Help (1st Script)

Featured Replies

Ok so I'm new to scripting, I have some understanding of Java and have been able to at least start a working script. I've been reading through the API but I can't figure out how to do this. There are several silk stalls. I want to theive from the same one, rather than running to the next closest stall when the first one is all out. 

 

I am using: Entity stall = objects.closest(11729);

 

How can I make it so it will only do one stall specifically, rather than running across to the second stall? I tried using the stall ID but I realized all stalls have the same ID so I was still running everywhere. I was thinking using some sort of filter with the coords but idk how

 

 

Also, I'm trying to use combat().getFighting() to register when a guard attacks because I have a kill state where I want to kill the guard, register he's dead, and then move onto the steal state etc. Any tips?

Edited by Chris1665

Entity stall = getObjects().closest("Silk stall");
Position p = stall.getPosition();
//thieve Stall
//on other loops, do this
Entity stall = (Entity) getObjects().closest(new Filter<RS2Object>() {
    @Override
    public boolean match(RS2Object rs) {
        return (rs.getPosition().equals(p) && rs.getName().contains("stall"));
    }
});

if (stall != null && !stall.getName().equals("Market stall")) {
    //thieve stall
}

The idea is that you do not want to thieve "Market stall" but rather the silk stall/tea stall/whatever stall, so you save the position when you first locate it to search in that position again :)

or a rather crude way of doing it but a method that works just fine:

Area area = new Area(0,0,0,0); //area around stall, defined and initi at top

RS2Object stall = objects.closest(area,"Stall name");

if (stall != null && stall.exists()) {
stall.interact("Steal-from");
//blah
}

(Not written in an IDE, whatever)

/*
Global variables.
*/

private Optional<Entity> stall = Optional.empty();

private Position position = new Position(0, 0, 0); // Set this to the position of your stall.

private Predicate<Entity> predicate = p -> p != null && p.exists() && p.getName().equals("Silk stall") && p.getPosition().equals(position); 

private Comparator<Entity> comparator = new Comparator<Entity>() {
            @Override
            public int compare(Entity a, Entity b) {
                return bs.getMap().distance(a.getPosition()) - bs.getMap().distance(b.getPosition());
            }
        }

/*
Loop.
*/

@Override
public int onLoop() {
if(!stall.isPresent() || !predicate.test(stall.get()) {
stall = getObjects().getAll().stream().filter(predicate).min(comparator);
}
else {
stall.get().interact("Steal-from");
}
return 1337;
}

Edited by Botre

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.