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

1 hour ago, Saitama Anonymous said:

I get this when I try running eclipse

U8tD33lbTWmzwlC3XaJKtA.png

Not quite sure if this is the right answer, but if i recall i had the same problem and it had something to do with installing the 32bit instead of the 64bit version.

1 minute ago, slazter said:

Not quite sure if this is the right answer, but if i recall i had the same problem and it had something to do with installing the 32bit instead of the 64bit version.

Ok, i'll give it a try

5 minutes ago, slazter said:

Not quite sure if this is the right answer, but if i recall i had the same problem and it had something to do with installing the 32bit instead of the 64bit version.

Works! tyvm

Noob question. The new form of Eclipse wants me to pick between Eclipse IDE for Java devs, EE devs, C++ devs,Javascript&web devs, or PHP devs..which one?
Edit: Ignore my dumb ass, I sucked at following instructions.

Edited by Jacksonpm23

  • 3 weeks later...
  • Author
1 hour ago, Simplintho said:

Why do you prefer Eclipse over Visual Studio Code or other IDE's?

It's the one I started off with and the one I have used since! 

  • 2 weeks later...

Hey i can't for the life of me figure out why this is not working >.>

I tried to modify ur script to be the start of a fishing script but i can get it to work. Currently when ran it will just be in the WAIT state. Most likely because it cant find the fishing spot is what i am assuming (even tho i am right by it). I have tried changing some things such as "Entity -> RS2Object" and "objects -> getObjects()"

import org.osbot.rs07.api.model.*;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import java.awt.*;
 
@ScriptManifest(author = "CanCo", info = "shrimper fisher", name = "CanFish", version = 0, logo = "")
public class main extends Script {
 
    @Override
    public void onStart() {
        log("My fisher v1");
    }
    
    private enum State {
        FISH, WAIT
    }
    private State getState() {
		Entity spot = objects.closest("Fishing spot");
		if (spot != null && !myPlayer().isAnimating())
			return State.FISH;
		return State.WAIT;
	}
  
    @Override
    public int onLoop() throws InterruptedException {
 switch (getState()) {
		case FISH:
                    log("going fishing..");
			Entity spot = objects.closest("Fishing spot");
			if (spot != null && !myPlayer().isAnimating()) 
                                spot.interact("Net-from");
                            break;	
		case WAIT:
                        log("waiting..");
			sleep(random(500, 800));
			break;
		}
		return random(200, 300);
    }
 
    @Override
    public void onExit() {
        log("STOPPED");
    }
 
    @Override
    public void onPaint(Graphics2D g) {
       
    }
 
}

 

Edited by CanCo

  • Author
6 hours ago, CanCo said:

Hey i can't for the life of me figure out why this is not working >.>

I tried to modify ur script to be the start of a fishing script but i can get it to work. Currently when ran it will just be in the WAIT state. Most likely because it cant find the fishing spot is what i am assuming (even tho i am right by it). I have tried changing some things such as "Entity -> RS2Object" and "objects -> getObjects()"


import org.osbot.rs07.api.model.*;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import java.awt.*;
 
@ScriptManifest(author = "CanCo", info = "shrimper fisher", name = "CanFish", version = 0, logo = "")
public class main extends Script {
 
    @Override
    public void onStart() {
        log("My fisher v1");
    }
    
    private enum State {
        FISH, WAIT
    }
    private State getState() {
		Entity spot = objects.closest("Fishing spot");
		if (spot != null && !myPlayer().isAnimating())
			return State.FISH;
		return State.WAIT;
	}
  
    @Override
    public int onLoop() throws InterruptedException {
 switch (getState()) {
		case FISH:
                    log("going fishing..");
			Entity spot = objects.closest("Fishing spot");
			if (spot != null && !myPlayer().isAnimating()) 
                                spot.interact("Net-from");
                            break;	
		case WAIT:
                        log("waiting..");
			sleep(random(500, 800));
			break;
		}
		return random(200, 300);
    }
 
    @Override
    public void onExit() {
        log("STOPPED");
    }
 
    @Override
    public void onPaint(Graphics2D g) {
       
    }
 
}

 

As dreameo stated, they are indeed NPCS. Use:

NPC fishingSpot = getNpcs().closest("Fishing spot");

Apa

nice guide :)

trying to write a fishing spot but it just keeps error on trying to find the actual location of the spot?

nevermind it's a NPC like you said above

Edited by JohnDoe1

  • 1 month later...

Great Quickstart guide, thanks!

I did have to change .entity to .RS2Object in my code for some reason - I'm sure I will work out why as I read into the API more!
Also there have been some interface changes in newer versions of eclipse (since your screenshots), adding the osbot jar file to your library is in a different interface in eclipse neon.

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.