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.

A Beginners Guide to Writing OSBot Scripts (where to get started!) by Apaec

Featured Replies

Man, hey! i got a problem i use this

 

 

import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
 
 
import java.awt.*;
 
@ScriptManifest(author = "Vacalao", info = "My first mining script", name = "MiningBankVarrock", version = 1.0, logo = "")
public class Main extends Script {
 private static final int rock_id = 14864;
   private static final int ore_id = 438;
 
    @Override
    public void onStart() {
        log("lets try");
    }
 
    @Override
    public int onLoop() throws InterruptedException {
        if(!myPlayer().isAnimating()){
            if(inventory.isFull()){
                inventory.dropAll(ore_id);
            }
            Entity rocks = objects.closest(rock_id);
            if(rocks != null){
                rocks.interact("Mine Rock");
                sleep(random(25, 30));
            }
        }
        return random(200, 300);
    }
 
    @Override
    public void onExit() {
        log("Thanks for test my script");
    }
 
    @Override
    public void onPaint(Graphics2D g) {
 
    }
 
}
 
 
Obviously i will put the iron value on the ores.. but when i compile all see good, but when i try run in my osbot the script no appear on local scripts, why? 
  • Author

 

Man, hey! i got a problem i use this

 

 

import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
 
 
import java.awt.*;
 
@ScriptManifest(author = "Vacalao", info = "My first mining script", name = "MiningBankVarrock", version = 1.0, logo = "")
public class Main extends Script {
 private static final int rock_id = 14864;
   private static final int ore_id = 438;
 
    @Override
    public void onStart() {
        log("lets try");
    }
 
    @Override
    public int onLoop() throws InterruptedException {
        if(!myPlayer().isAnimating()){
            if(inventory.isFull()){
                inventory.dropAll(ore_id);
            }
            Entity rocks = objects.closest(rock_id);
            if(rocks != null){
                rocks.interact("Mine Rock");
                sleep(random(25, 30));
            }
        }
        return random(200, 300);
    }
 
    @Override
    public void onExit() {
        log("Thanks for test my script");
    }
 
    @Override
    public void onPaint(Graphics2D g) {
 
    }
 
}
 
 
Obviously i will put the iron value on the ores.. but when i compile all see good, but when i try run in my osbot the script no appear on local scripts, why? 

 

 

Do you have any other local scripts?

 

What you should do is close OSBot and delete (or move) your other local scripts (and delete this one). Then reboot your OSBot, and then compile the code. It should then show up

 

apa

no, i got one sdn script, the frost miner.. but dont have any other local script, i already do that like 10 times, redownload eclipse, redownload osbot, and eliminate all carpets, and nothing, i cant see my local script :/

  • Author

no, i got one sdn script, the frost miner.. but dont have any other local script, i already do that like 10 times, redownload eclipse, redownload osbot, and eliminate all carpets, and nothing, i cant see my local script :/

 

Is your build path the latest osbot? :/

2.3.117


now i donwload the 119 OSbot, and running the 119 i can see you teaThiever but no my script, i am doing any barely wrong?


tired :/ cant do any, i just will buy scripts, cant make

TL;DR

 

Teach me in two sentences please.

 

 

OT: Seriously high quality guide though. Bookmarked.

  • Author

2.3.117

now i donwload the 119 OSbot, and running the 119 i can see you teaThiever but no my script, i am doing any barely wrong?

tired :/ cant do any, i just will buy scripts, cant make

Don't give up so easily, if you can see the thiever but not ur script then I have no idea...

are u sure that there are no errors? everything in ur script looks okay...

apa

private State getState() {
        Entity stall = objects.closest("Tea stall");
        if (!inventory.isEmpty())
            return State.DROP;
        if (stall != null)
            return State.STEAL;
        return State.WAIT;
    }

is it really necessary here define the stall again?  because you dont seem to need it in this block of code and u define it in your onloop or am i wrong here? 

 

nvm figured it out

Edited by amoeder

Can someone give me some directions on how to make a simple bone grabber and banker? (port sarim, seagulls)

  • Author

Can someone give me some directions on how to make a simple bone grabber and banker? (port sarim, seagulls)

 

Follow the framework I have for the tea thiever.

 

But you're going to need different states:

 

BANK, GRAB

 

the grab state would have a check for bones:

 

GroundItem bone = groundItems.closest("Bones");

if (bone != null && bone.exists()) {

bone.interact("Take");

}

 

The other state would be bank

define bank the same way as stall, and interact wtih it the same way. Take a look at the banking API to see the interactinos :)

 

apa

Awesome guide, would making a yew chopper be the same sort of idea? Except states would be CHOP, BANK and WAIT. I've spent a lot of time using actionscript 2 in flash, could never be bothered to use java for rsbots. You made all the hard parts seem so simple though so I might try it out :)

i dont understand how i get the codes i want to make chop& dropper i didnt seee how u got ur script coding thing there?

  • Author

Awesome guide, would making a yew chopper be the same sort of idea? Except states would be CHOP, BANK and WAIT. I've spent a lot of time using actionscript 2 in flash, could never be bothered to use java for rsbots. You made all the hard parts seem so simple though so I might try it out smile.png

 

Yep. exactly the same idea except you may need walking states aswell (eg to and from). You could equally condense it into 1 state but then you're not making full use of the framework available :D

 

Ye it's really not as complicated as you may first think. Deffo worth a try and hopefully you'll be able to pull off some nice scripts :)

 

apa

 

i dont understand how i get the codes i want to make chop& dropper i didnt seee how u got ur script coding thing there?

 

Open the spoilers stage by stage and it will talk you through it!

 

apa

Yep. exactly the same idea except you may need walking states aswell (eg to and from). You could equally condense it into 1 state but then you're not making full use of the framework available biggrin.png

 

Ye it's really not as complicated as you may first think. Deffo worth a try and hopefully you'll be able to pull off some nice scripts smile.png

 

apa

 

Do I need to set my own path (tiles and such) or is there some sort of API that has easy bank methods there?

  • Author

Do I need to set my own path (tiles and such) or is there some sort of API that has easy bank methods there?

 

 

in terms of pathwalking, you'll have to record your own path (you can use divine's utility on the sdn to do this, i've heard it's good :)

with the pre-recorded path (as a Position[]), you can use localwalker to walk it:

 

localWalker.walkPath(Position[] path);

 

and that will get you from A to B.

 

As for banking, you can use the fruitful banking API which will allow you to open the closest bank provided you're close enough, as well as allow you to withdraw, deposit etc 

 

eg

 

bank.depositAll()

deposits your inventory.

 

apa

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.