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

@Apaec I get the same error now for RS2Object  now. I have the OSBot 2.4.118 jar in referenced libraries. Eclipse quick-fixed it for me when I clicked on RS2Object  and selected import RS2Object(or something similar). not sure what was going on

  • Author
2 minutes ago, lfcandy said:

@Apaec I get the same error now for RS2Object  now. I have the OSBot 2.4.118 jar in referenced libraries. Eclipse quick-fixed it for me when I clicked on RS2Object  and selected import RS2Object(or something similar). not sure what was going on

Can you send me a screenshot of the exact error you're getting perhaps?

forgot to crop...

If I click 'import entity from osbot' the red line goes away and the script works. 

@Apaec

Edited by lfcandy

  • Author
18 minutes ago, lfcandy said:

forgot to crop...

If I click 'import entity from osbot' the red line goes away and the script works. 

@Apaec

Ah, yeah. You need to make sure you import the things that you're using!

  • 2 weeks later...

Alright so I'm trying to make a basic powerfisher using my very limited knowledge.

Here's what I have
 


 

Quote

 

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

@ScriptManifest(name = "skeetfish", author = "skeetballs", version = 1.0, info = "", logo = "") 

public class Todfish extends Script {

private enum State {
    FISH, DROP, WAIT
};

private State getState() {
    NPC fishspot = (NPC) objects.closest("Fishing Spot");
    if (!inventory.isEmptyExcept("Feather","Fly fishing rod"))
        return State.DROP;
    if (fishspot != null)
        return State.FISH;
    return State.WAIT;
}

@Override

public int onLoop() throws InterruptedException {

switch (getState()) {

case FISH:

NPC fishspot = (NPC) objects.closest("Fishing spot");

if (fishspot != null) {

fishspot.interact("Lure");

}

break;

case DROP:

inventory.dropAll("Trout","Salmon");

break;

case WAIT:

sleep(random(500, 700));

break;

}

return random(200, 300);

}
}
 

 

 

Edited by skeetballs

  • 1 month later...
  • Author

Just rewrote a few parts of the tutorial since a few sections were unclear and poorly written. If you're reading, please refresh the page!

Cheers

-Apa

  • 3 weeks later...

Really nice tutorial! I managed to make my first script ever! It only powerchops oak tho :kappa:

  • 2 weeks later...
  • Author
9 hours ago, Jakobson said:

Well writed guide, nice.

How did you start your own coding career?

Started out here, found a reputable scripter and annoyed them alot with questions!

On 6/28/2017 at 5:21 AM, Apaec said:

Started out here, found a reputable scripter and annoyed them alot with questions!

Thanks for the guide, this will probably be me

Edited by osrs_pvm

  • Author
37 minutes ago, osrs_pvm said:

Thanks for the guide, this will probably be me

To answer your previous question, you will see that our script extends Script. This is an abstract class in the OSBot API and since we are extending it, we have access to all of its attributes. An example of an attribute is inventory, whereby we are calling the super inventory object attribute and using the methods that it provides. As for the stall, you will find that that is initialised just above the snippet you quoted, we're creating an instance of an RS2Object which is an API object describing an ingame object. 

Hope that makes sense, let me know if you're still unsure. Since you edited the post I would assume you figured this out yourself but I just thought i'd drop a quick reply in to clear it up if you didn't!

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