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.

My script won't start

Featured Replies

Hello,

So I've been watching a YouTube video and looking at the tutorials posted on the forums on creating my first script.

I'm trying to run a test like the video, when it first ran it's test, but when I attempt to run my code, nothing happens.

 

and here's the code, it's not exactly like the video, but I don't see the problem with when I try to run it.

 


import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

import java.awt.Graphics2D;

import org.osbot.rs07.api.Inventory;
import org.osbot.rs07.api.model.NPC;

@ScriptManifest(author = "Kingbutton", name = "Shrimp Catcher", info = "Catches shrimp at Draynor Village", version = 0.1, logo = "")
public final class Main extends Script {

    NPC spot = npcs.closest("Fishing spot");

    @Override
    public void onStart() {
        log("You have activated Shrimp Catcher!");
    }

    @Override
    public final int onLoop() throws InterruptedException {

        if (!inventory.isFull()) {

            // fishes
            if (spot != null) {
                if (spot.isVisible()) {
                    //if() adding this later.
                    spot.interact("Net");
                } else {
                    // else statement
                    camera.toEntity(spot);
                }
            }
        }
        return 50;
    }

    public void onExit() {
        log("Thanks for using Shrimp Catcher!");
    }

    @Override
    public void onPaint(Graphics2D g) {
        // gui

    }

}

 NPC spot = npcs.closest("Fishing spot");

put this below  this 

    public final int onLoop() throws InterruptedException {

  • Author
27 minutes ago, Get Rekt said:

 NPC spot = npcs.closest("Fishing spot");

put this below  this 

    public final int onLoop() throws InterruptedException {

Nice it works! Can you explain to me I need to put that line of code there though?

2 hours ago, kingbutton said:

Nice it works! Can you explain to me I need to put that line of code there though?

Cause the first thing OSBot does is do stuff in onStart() method, then loops your logic in onLoop() method. You fetch the fishing spot only when the class is initialized (which will be null).

You want to find your npcs in the onLoop() method.  

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.