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.

How come my bot won't run (at all) when I start it in OSBot

Featured Replies

I see no reason for the bot not to turn on at all, could someone hopefully tell me what I'm doing wrong?

package SnootsAnchovyFisher;

import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.api.model.Player;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;

@ScriptManifest(version = 0.1, logo = "", info = "Simple Anchovy fisher & cooker", name = "Snoots' Anchovy Fisher", author = "Snoots")

public class Main extends Script {

    // @NAME: Areas
    // @DESCRIPTION: All the areas we will be using
    private Area fishingArea = new Area(3266, 3149, 3278, 3139);
    private Area bankArea = new Area(3271, 3161, 3269, 3173);

    //This boolean determines if the player has chosen the fishing option or not
    static boolean isFishing = true;

    public Player bot = myPlayer();

    // @NAME: Fishing Function
    // @DESCRIPTION: This method stores the code for the fishing bot
    public void fishingFunction() throws InterruptedException {
        NPC anchovyFish = getNpcs().closest("Fishing spot");

        //If bot is at the fishing area & not interacting with the anchovies, then interact with them
        if(fishingArea.contains(bot)) {
            if(anchovyFish != null) {
                if(!bot.isInteracting(anchovyFish)) {
                    if(anchovyFish.interact("Small Net")) {
                        sleep(random(5000, 1000));
                        new ConditionalSleep(25000) {
                            @Override
                            public boolean condition() {
                                return !bot.isInteracting(anchovyFish) || !anchovyFish.exists();
                            }
                        }.sleep();
                    //If a dialogue opens up, click continue
                    } if(dialogues.inDialogue()) {
                        dialogues.clickContinue();
                    }
                }
            }
        //If bot is not at the fishing area, then walk to the fishing area
        } else if(!fishingArea.contains(bot)) {
            walking.webWalk(fishingArea);
        }
    }

    // @NAME: onStart function
    // @DESCRIPTION: Script gets executed once everytime the bot starts
    @Override
    public void onStart() {
        log("'Snoots' Anchovy fishing & cooking' has been started.");
    }

    // @NAME: onLoop function
    // @DESCRIPTION: Script loops whatever is inside this method
    @Override
    public int onLoop() throws InterruptedException {
        if(!getInventory().isFull() && isFishing == true) {
            fishingFunction();
        }

        return 1000;
    }

    // @NAME: onExit function
    // @DESCRIPTION: Script gets executed once everytime the bot stops
    @Override
    public void onExit() {
        log("'Snoots' Anchovy fishing & cooking' has stopped.");
    }
}

 

  • Author
2 hours ago, Chris said:

 public Player bot = myPlayer();

I removed the public and it didnt work, so I just removed the whole code and used myPlayer().

 

3 hours ago, snoots said:

I see no reason for the bot not to turn on at all, could someone hopefully tell me what I'm doing wrong?




package SnootsAnchovyFisher;

import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.api.model.Player;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;

@ScriptManifest(version = 0.1, logo = "", info = "Simple Anchovy fisher & cooker", name = "Snoots' Anchovy Fisher", author = "Snoots")

public class Main extends Script {

    // @NAME: Areas
    // @DESCRIPTION: All the areas we will be using
    private Area fishingArea = new Area(3266, 3149, 3278, 3139);
    private Area bankArea = new Area(3271, 3161, 3269, 3173);

    //This boolean determines if the player has chosen the fishing option or not
    static boolean isFishing = true;

    public Player bot = myPlayer();

    // @NAME: Fishing Function
    // @DESCRIPTION: This method stores the code for the fishing bot
    public void fishingFunction() throws InterruptedException {
        NPC anchovyFish = getNpcs().closest("Fishing spot");

        //If bot is at the fishing area & not interacting with the anchovies, then interact with them
        if(fishingArea.contains(bot)) {
            if(anchovyFish != null) {
                if(!bot.isInteracting(anchovyFish)) {
                    if(anchovyFish.interact("Small Net")) {
                        sleep(random(5000, 1000));
                        new ConditionalSleep(25000) {
                            @Override
                            public boolean condition() {
                                return !bot.isInteracting(anchovyFish) || !anchovyFish.exists();
                            }
                        }.sleep();
                    //If a dialogue opens up, click continue
                    } if(dialogues.inDialogue()) {
                        dialogues.clickContinue();
                    }
                }
            }
        //If bot is not at the fishing area, then walk to the fishing area
        } else if(!fishingArea.contains(bot)) {
            walking.webWalk(fishingArea);
        }
    }

    // @NAME: onStart function
    // @DESCRIPTION: Script gets executed once everytime the bot starts
    @Override
    public void onStart() {
        log("'Snoots' Anchovy fishing & cooking' has been started.");
    }

    // @NAME: onLoop function
    // @DESCRIPTION: Script loops whatever is inside this method
    @Override
    public int onLoop() throws InterruptedException {
        if(!getInventory().isFull() && isFishing == true) {
            fishingFunction();
        }

        return 1000;
    }

    // @NAME: onExit function
    // @DESCRIPTION: Script gets executed once everytime the bot stops
    @Override
    public void onExit() {
        log("'Snoots' Anchovy fishing & cooking' has stopped.");
    }
}

 

You can't initiliaze a Player object like that, you have to do it in the onStart method.
 

package SnootsAnchovyFisher;

import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.api.model.Player;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;

@ScriptManifest(version = 0.1, logo = "", info = "Simple Anchovy fisher & cooker", name = "Snoots' Anchovy Fisher", author = "Snoots")

public class Main extends Script {

    // @NAME: Areas
    // @DESCRIPTION: All the areas we will be using
    private Area fishingArea = new Area(3266, 3149, 3278, 3139);
    private Area bankArea = new Area(3271, 3161, 3269, 3173);

    //This boolean determines if the player has chosen the fishing option or not
    static boolean isFishing = true;

    public Player bot;

    // @NAME: Fishing Function
    // @DESCRIPTION: This method stores the code for the fishing bot
    public void fishingFunction() throws InterruptedException {
        NPC anchovyFish = getNpcs().closest("Fishing spot");

        //If bot is at the fishing area & not interacting with the anchovies, then interact with them
        if(fishingArea.contains(bot)) {
            if(anchovyFish != null) {
                if(!bot.isInteracting(anchovyFish)) {
                    if(anchovyFish.interact("Small Net")) {
                        sleep(random(5000, 1000));
                        new ConditionalSleep(25000) {
                            @Override
                            public boolean condition() {
                                return !bot.isInteracting(anchovyFish) || !anchovyFish.exists();
                            }
                        }.sleep();
                    //If a dialogue opens up, click continue
                    } if(dialogues.inDialogue()) {
                        dialogues.clickContinue();
                    }
                }
            }
        //If bot is not at the fishing area, then walk to the fishing area
        } else if(!fishingArea.contains(bot)) {
            walking.webWalk(fishingArea);
        }
    }

    // @NAME: onStart function
    // @DESCRIPTION: Script gets executed once everytime the bot starts
    @Override
    public void onStart() {
        log("'Snoots' Anchovy fishing & cooking' has been started.");
		bot = myPlayer();
    }

    // @NAME: onLoop function
    // @DESCRIPTION: Script loops whatever is inside this method
    @Override
    public int onLoop() throws InterruptedException {
        if(!getInventory().isFull() && isFishing == true) {
            fishingFunction();
        }

        return 1000;
    }

    // @NAME: onExit function
    // @DESCRIPTION: Script gets executed once everytime the bot stops
    @Override
    public void onExit() {
        log("'Snoots' Anchovy fishing & cooking' has stopped.");
    }
}

 

Edited by Khaleesi

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.