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.

script Can't run on osbot (help)

Featured Replies

I write a script and want it to run on osbot. I can find the script in script selector, but it can't be started, who do you know how to run a script on osbot??

  • Author

do you mind sharing the source?

 

I just have a frame,  it seems that i can't finish it. I am looking for a auto talker to shout in the RS07 game. The auto talker can shout advertising slogan in different world of RS 07 at the same time. Do you know this kind of script? Can you help me? I also can pay you if it can shout advertising in different world of RS 07 at the same time with osbot.

got one-o these badboys up in that b****?
 

@ScriptManifest(author = "Your Name", name = "Example-Name", version = 0.1, info = "This is an Example Manifest", logo = "")

I have actually run into the same error as OP (and I have a script manifest in mine). Sorry that my code is so cobbled together but the source is below.

Also, if anyone has any tips they would be greatly appreciated. Thanks!

 

EDIT: I found it was something to do with my WebWalkEvent "toCraftAltar". I removed it and simply placed a webWalk and it worked.

import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.map.Position;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.event.WebWalkEvent;
import org.osbot.rs07.api.webwalk.INodeRouteFinder;
import org.osbot.rs07.utility.*;
import org.osbot.rs07.api.map.constants.*;
import java.awt.Color;
import java.awt.*;

@ScriptManifest(name = "WaterCrafter", author = "WallNuts", version = 1.0, info = "", logo = "")
public class Main extends Script {
    Area altararea = new Area(new Position(3181, 3168, 0), new Position(3183, 3163, 0));
    Area bankarea = Banks.DRAYNOR;
    Area altar2area = null;
    long crafted = 0;
    int needThing, equip = 0;
    public WebWalkEvent toBank = new WebWalkEvent(INodeRouteFinder.createAdvanced(), new Position(3092, 3243,0));
    public WebWalkEvent toAltar = new WebWalkEvent(INodeRouteFinder.createAdvanced(), new Position(3183,3165,0));
    public WebWalkEvent toCraftAltar = new WebWalkEvent(INodeRouteFinder.createAdvanced(), altar2area.getRandomPosition());

    @Override
    public void onStart() {

        log("Script begins"); //Code here will execute before the loop is started
    }

    private enum State {
        CRAFT, DROPOFF, WAIT,
    }
    

    private State getState() {
        if (inventory.contains("Rune Essence"))
            return State.CRAFT;
        if (inventory.contains("Water Rune") || !inventory.contains("Rune Essence"))
            return State.DROPOFF;
        return State.WAIT;
    }



    @Override
    public void onExit() {
        log("Script ends"); //Code here will execute after the script ends
    }

    @Override
    public int onLoop() throws InterruptedException {
        switch (getState()) {
            case CRAFT:
                if(equip == 1){
                    while(!getEquipment().contains("Water Tiara")) {
                        bank.close();
                        getInventory().interact("Wear", "Water Tiara");
                        sleep(random(500, 1000));
                    }
                    equip = 0;
                }
                toAltar.setBreakCondition(new Condition() { //if true, break the walker.
                    @Override
                    public boolean evaluate() {
                        return altararea.contains(myPosition()); //area.contains(myPos) || pos.distance() <= threshold
                    }
                });
                execute(toAltar);

                log("to the altar");
                Entity altar1 = objects.closest("Mysterious Ruins");
                if (altar1 != null) {
                    sleep(random(200, 600));
                    altar1.interact("Enter");
                    log("teleported");
                    sleep(random(2000, 3000));
                }

                Entity altar2 = objects.closest("Altar");
                while (!inventory.contains("Water rune")) {
                    if (altar2 != null) {
                        log("Found altar");
                        if(!altar2.isVisible()){
                            altar2area = altar2.getArea(2);
                            toCraftAltar.setBreakCondition(new Condition() { //walking to crafting altar b/c always finds it but has problems interacting
                                @Override
                                public boolean evaluate() {
                                    return !altar2.isVisible();
                                }
                            });
                            execute(toCraftAltar);
                            sleep(1000);
                            if(!altar2.isVisible()){// if the conditional walking over didn't work webwalk on over
                                walking.webWalk(altar2area);
                            }
                            log("couldn't click");
                        }
                        if(altar2.interact("Craft-rune")){
                            sleep(random(1000, 2500));
                            break;
                        }
                        sleep(random(1000, 2500));
                    }
                    sleep(random(500, 750));
                }
                if(inventory.contains("Water Rune")){
                    crafted = crafted + inventory.getAmount("Water rune");
                }

                sleep(300);
                break;
            case DROPOFF:
                Entity portal = objects.closest("portal");
                if(portal != null){
                    sleep(random(200, 600));
                    if(portal.interact("Use")){
                        while(myPlayer().isMoving()){
                            sleep(random(2000, 3500));
                        }
                    }
                }
                skills.hoverSkill(Skill.RUNECRAFTING);//in case watching bot get a check on lvl
                sleep(random(800, 1500));
                toBank.setBreakCondition(new Condition() {
                    @Override
                    public boolean evaluate() {
                        return bankarea.contains(myPosition());
                    }
                });

                execute(toBank);
                log("To the bank.");

                if(getEquipment().contains("Water Tiara") || getInventory().contains("Water Talisman")){//if need to take out water talisman or tiara
                    needThing = 0;
                }
                else{
                    needThing = 1;
                }

                if(bankarea.contains(myPosition())) {
                    if(random(10)>2){//80% of time use bank booth
                        log("Bank booth");
                        RS2Object bank = getObjects().closest("Bank booth");
                        if (bank != null) {
                            if (bank.interact("Bank")) {

                                while(inventory.contains("Water rune")){
                                    getBank().depositAll("Water rune");
                                    sleep(random(500, 2000));
                                }
                                sleep(random(1000, 2000));
                                if(needThing ==1 && getBank().contains("Water Tiara") || getBank().contains("Water talisman")){//if need to get talisman or tiara withdraw it
                                    if(getBank().contains("Water Tiara")){
                                        getBank().withdraw("Water Tiara", 1);
                                        equip = 1; //make note to equip later
                                    }
                                    else{
                                        getBank().withdraw("Water Talisman", 1);
                                    }
                                }
                                if(getBank().contains("Rune essence")){
                                    while(!inventory.contains("Rune essence")){

                                        getBank().withdrawAll("Rune essence");
                                        sleep(random(500, 1500));
                                    }}
                                else{
                                    log("no rune ess");
                                    sleep(1000);
                                    if(!getBank().contains("Rune essence")){
                                        stop(); //no rune ess logout
                                    }
                                }
                            }
                        }
                    }
                    else{
                        log("Banker");
                        NPC banker = npcs.closest("Banker");
                        if (banker != null) {
                            if (banker.interact("Bank")) {
                                while(inventory.contains("Water rune")){
                                    getBank().depositAll("Water rune");
                                    sleep(random(500, 2000));
                                }
                                sleep(random(1000, 2000));
                                if(needThing ==1 && getBank().contains("Water Tiara") || getBank().contains("Water talisman")){
                                    if(getBank().contains("Water Tiara")){
                                        getBank().withdraw("Water Tiara", 1);
                                        equip = 1;
                                    }
                                    else{
                                        getBank().withdraw("Water Talisman", 1);
                                    }
                                }
                                if(getBank().contains("Rune essence")){
                                    while(!inventory.contains("Rune essence")){

                                        getBank().withdrawAll("Rune essence");
                                        sleep(random(500, 1500));
                                    }}
                                else{
                                    log("no rune ess");
                                    sleep(1000);
                                    if(!getBank().contains("Rune essence")){
                                        stop();
                                    }
                                }
                            }
                        }
                    }

                }
                else{
                    toBank.setBreakCondition(new Condition() { //if true, break the walker.
                        @Override
                        public boolean evaluate() {
                            return bankarea.contains(myPosition()); //area.contains(myPos) || pos.distance() <= threshold
                        }
                    });
                    execute(toBank);
                    sleep(400);
                }
                break;
            case WAIT:
                sleep(random(500, 700));
                break;
        }
        return random(200, 300);
    }

    @Override
    public void onPaint(Graphics2D g) {
        //This is where you will put your code for paint(s)
        g.setColor(Color.yellow);
        g.drawString("Water runes crafted: " + String.valueOf(crafted), 10, 20);

        Point mP = getMouse().getPosition();

        g.drawLine(mP.x - 5, mP.y + 5, mP.x + 5, mP.y - 5);
        g.drawLine(mP.x + 5, mP.y + 5, mP.x - 5, mP.y - 5);
    }


}

Edited by wallnuts5

I have actually run into the same error as OP (and I have a script manifest in mine). Sorry that my code is so cobbled together but the source is below.

Also, if anyone has any tips they would be greatly appreciated. Thanks!

 

EDIT: I found it was something to do with my WebWalkEvent "toCraftAltar". I removed it and simply placed a webWalk and it worked.

import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.map.Position;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.event.WebWalkEvent;
import org.osbot.rs07.api.webwalk.INodeRouteFinder;
import org.osbot.rs07.utility.*;
import org.osbot.rs07.api.map.constants.*;
import java.awt.Color;
import java.awt.*;

@ScriptManifest(name = "WaterCrafter", author = "WallNuts", version = 1.0, info = "", logo = "")
public class Main extends Script {
    Area altararea = new Area(new Position(3181, 3168, 0), new Position(3183, 3163, 0));
    Area bankarea = Banks.DRAYNOR;
    Area altar2area = null;
    long crafted = 0;
    int needThing, equip = 0;
    public WebWalkEvent toBank = new WebWalkEvent(INodeRouteFinder.createAdvanced(), new Position(3092, 3243,0));
    public WebWalkEvent toAltar = new WebWalkEvent(INodeRouteFinder.createAdvanced(), new Position(3183,3165,0));
    public WebWalkEvent toCraftAltar = new WebWalkEvent(INodeRouteFinder.createAdvanced(), altar2area.getRandomPosition());

    @Override
    public void onStart() {

        log("Script begins"); //Code here will execute before the loop is started
    }

    private enum State {
        CRAFT, DROPOFF, WAIT,
    }
    

    private State getState() {
        if (inventory.contains("Rune Essence"))
            return State.CRAFT;
        if (inventory.contains("Water Rune") || !inventory.contains("Rune Essence"))
            return State.DROPOFF;
        return State.WAIT;
    }



    @Override
    public void onExit() {
        log("Script ends"); //Code here will execute after the script ends
    }

    @Override
    public int onLoop() throws InterruptedException {
        switch (getState()) {
            case CRAFT:
                if(equip == 1){
                    while(!getEquipment().contains("Water Tiara")) {
                        bank.close();
                        getInventory().interact("Wear", "Water Tiara");
                        sleep(random(500, 1000));
                    }
                    equip = 0;
                }
                toAltar.setBreakCondition(new Condition() { //if true, break the walker.
                    @Override
                    public boolean evaluate() {
                        return altararea.contains(myPosition()); //area.contains(myPos) || pos.distance() <= threshold
                    }
                });
                execute(toAltar);

                log("to the altar");
                Entity altar1 = objects.closest("Mysterious Ruins");
                if (altar1 != null) {
                    sleep(random(200, 600));
                    altar1.interact("Enter");
                    log("teleported");
                    sleep(random(2000, 3000));
                }

                Entity altar2 = objects.closest("Altar");
                while (!inventory.contains("Water rune")) {
                    if (altar2 != null) {
                        log("Found altar");
                        if(!altar2.isVisible()){
                            altar2area = altar2.getArea(2);
                            toCraftAltar.setBreakCondition(new Condition() { //walking to crafting altar b/c always finds it but has problems interacting
                                @Override
                                public boolean evaluate() {
                                    return !altar2.isVisible();
                                }
                            });
                            execute(toCraftAltar);
                            sleep(1000);
                            if(!altar2.isVisible()){// if the conditional walking over didn't work webwalk on over
                                walking.webWalk(altar2area);
                            }
                            log("couldn't click");
                        }
                        if(altar2.interact("Craft-rune")){
                            sleep(random(1000, 2500));
                            break;
                        }
                        sleep(random(1000, 2500));
                    }
                    sleep(random(500, 750));
                }
                if(inventory.contains("Water Rune")){
                    crafted = crafted + inventory.getAmount("Water rune");
                }

                sleep(300);
                break;
            case DROPOFF:
                Entity portal = objects.closest("portal");
                if(portal != null){
                    sleep(random(200, 600));
                    if(portal.interact("Use")){
                        while(myPlayer().isMoving()){
                            sleep(random(2000, 3500));
                        }
                    }
                }
                skills.hoverSkill(Skill.RUNECRAFTING);//in case watching bot get a check on lvl
                sleep(random(800, 1500));
                toBank.setBreakCondition(new Condition() {
                    @Override
                    public boolean evaluate() {
                        return bankarea.contains(myPosition());
                    }
                });

                execute(toBank);
                log("To the bank.");

                if(getEquipment().contains("Water Tiara") || getInventory().contains("Water Talisman")){//if need to take out water talisman or tiara
                    needThing = 0;
                }
                else{
                    needThing = 1;
                }

                if(bankarea.contains(myPosition())) {
                    if(random(10)>2){//80% of time use bank booth
                        log("Bank booth");
                        RS2Object bank = getObjects().closest("Bank booth");
                        if (bank != null) {
                            if (bank.interact("Bank")) {

                                while(inventory.contains("Water rune")){
                                    getBank().depositAll("Water rune");
                                    sleep(random(500, 2000));
                                }
                                sleep(random(1000, 2000));
                                if(needThing ==1 && getBank().contains("Water Tiara") || getBank().contains("Water talisman")){//if need to get talisman or tiara withdraw it
                                    if(getBank().contains("Water Tiara")){
                                        getBank().withdraw("Water Tiara", 1);
                                        equip = 1; //make note to equip later
                                    }
                                    else{
                                        getBank().withdraw("Water Talisman", 1);
                                    }
                                }
                                if(getBank().contains("Rune essence")){
                                    while(!inventory.contains("Rune essence")){

                                        getBank().withdrawAll("Rune essence");
                                        sleep(random(500, 1500));
                                    }}
                                else{
                                    log("no rune ess");
                                    sleep(1000);
                                    if(!getBank().contains("Rune essence")){
                                        stop(); //no rune ess logout
                                    }
                                }
                            }
                        }
                    }
                    else{
                        log("Banker");
                        NPC banker = npcs.closest("Banker");
                        if (banker != null) {
                            if (banker.interact("Bank")) {
                                while(inventory.contains("Water rune")){
                                    getBank().depositAll("Water rune");
                                    sleep(random(500, 2000));
                                }
                                sleep(random(1000, 2000));
                                if(needThing ==1 && getBank().contains("Water Tiara") || getBank().contains("Water talisman")){
                                    if(getBank().contains("Water Tiara")){
                                        getBank().withdraw("Water Tiara", 1);
                                        equip = 1;
                                    }
                                    else{
                                        getBank().withdraw("Water Talisman", 1);
                                    }
                                }
                                if(getBank().contains("Rune essence")){
                                    while(!inventory.contains("Rune essence")){

                                        getBank().withdrawAll("Rune essence");
                                        sleep(random(500, 1500));
                                    }}
                                else{
                                    log("no rune ess");
                                    sleep(1000);
                                    if(!getBank().contains("Rune essence")){
                                        stop();
                                    }
                                }
                            }
                        }
                    }

                }
                else{
                    toBank.setBreakCondition(new Condition() { //if true, break the walker.
                        @Override
                        public boolean evaluate() {
                            return bankarea.contains(myPosition()); //area.contains(myPos) || pos.distance() <= threshold
                        }
                    });
                    execute(toBank);
                    sleep(400);
                }
                break;
            case WAIT:
                sleep(random(500, 700));
                break;
        }
        return random(200, 300);
    }

    @Override
    public void onPaint(Graphics2D g) {
        //This is where you will put your code for paint(s)
        g.setColor(Color.yellow);
        g.drawString("Water runes crafted: " + String.valueOf(crafted), 10, 20);

        Point mP = getMouse().getPosition();

        g.drawLine(mP.x - 5, mP.y + 5, mP.x + 5, mP.y - 5);
        g.drawLine(mP.x + 5, mP.y + 5, mP.x - 5, mP.y - 5);
    }


}

Just a tip for the WebWalking (didn't check the whole script)

INodeRouteFinder routeFinder;
in your onStart() method

routeFinder = INodeRouteFinder.createAdvanced();
then you can simply do

public WebWalkEvent toBank = new WebWalkEvent(routeFinder, new Position(3092, 3243,0));
This will save allot of resources.

Just a tip for the WebWalking (didn't check the whole script)

 

INodeRouteFinder routeFinder;
in your onStart() method

routeFinder = INodeRouteFinder.createAdvanced();
then you can simply do

public WebWalkEvent toBank = new WebWalkEvent(routeFinder, new Position(3092, 3243,0));
This will save allot of resources.

 

Thanks for the help!

 

Would you suggest I define my WebWalkEvents at the top of my script as public (where i have them in the above source) or should i define them right before I call them?

Thanks for the help!

 

Would you suggest I define my WebWalkEvents at the top of my script as public (where i have them in the above source) or should i define them right before I call them?

    public WebWalkEvent toBank = new WebWalkEvent(INodeRouteFinder.createAdvanced(), new Position(3092, 3243,0));
    public WebWalkEvent toAltar = new WebWalkEvent(INodeRouteFinder.createAdvanced(), new Position(3183,3165,0));
    public WebWalkEvent toCraftAltar = new WebWalkEvent(INodeRouteFinder.createAdvanced(), altar2area.getRandomPosition());

to

    public WebWalkEvent toBank;
    public WebWalkEvent toAltar;
    public WebWalkEvent toCraftAltar;

 @Override
 public void onStart() {
 toBank = new WebWalkEvent(INodeRouteFinder.createAdvanced(), new Position(3092, 3243,0));
 toAltar = new WebWalkEvent(INodeRouteFinder.createAdvanced(), new Position(3183,3165,0));
 toCraftAltar = new WebWalkEvent(INodeRouteFinder.createAdvanced(), altar2area.getRandomPosition());
 }

this will most likely fix your problem

Thanks for the help!

Would you suggest I define my WebWalkEvents at the top of my script as public (where i have them in the above source) or should i define them right before I call them?

You should define it before you call them, yes. I have my own framework so I did it different. However, don't do it like the guy above me said. That sucks.

Send me a pm if you need help.

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.