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.

Mule script not wroking

Featured Replies

import org.osbot.rs07.api.map.constants.Banks;
import org.osbot.rs07.api.ui.Message;
import org.osbot.rs07.script.Script;

import org.osbot.rs07.script.ScriptManifest;

@ScriptManifest(name = "muler", author = "Nor3g", version = 1.0, info = "muler", logo = "")

public class Muler extends Script {

    String thebot = getParameters();
    String thebotrep = thebot.replace(' ', '\u00A0');

    @Override
    public void onStart() {
        //Code here will execute before the loop is started
    }
    @Override
    public void onExit() {
        System.exit(0);
        //Code here will execute after the script ends
    }
    @Override
    public int onLoop() throws InterruptedException {
        if (!Banks.VARROCK_WEST.contains(myPosition())) {
            getWalking().webWalk(Banks.VARROCK_WEST);
        } else if (Banks.VARROCK_WEST.contains(myPosition()) && getPlayers().closest(thebotrep) != null) {
            getPlayers().closest(thebotrep).interact("Trade with");
            sleep(random(450, 5000));
        } else if (!trade.getOtherPlayer().equals(thebotrep)) {
            trade.declineTrade();
            sleep(random(450, 5000));
        } else if (!trade.getTheirOffers().contains("Coins")) {
            sleep(random(450, 5000));
        } else if (trade.getTheirOffers().contains("Coins")) {
            trade.acceptTrade();
            sleep(random(450, 5000));
        } else if (trade.isSecondInterfaceOpen()) {
            if (!trade.acceptTrade()) {
                trade.acceptTrade();
                sleep(random(450, 5000));
            }
        }
        return 100; //The amount of time in milliseconds before the loop starts over
    }

    public void onMessage(Message message) {
        if (message.getMessage().contains("Accepted trade.")) {
            stop();
        }

    }
}

 

Im trying to test out my Mulescript, but it won't start. I tried to run it with this CLI command:

java -jar "osbot 2.5.38.jar" -login Nor3g:password -bot name:pass:1234 -script muler:thebot

Or more correctly, it's a bat file that is in the same folder that the osbot client is.

The client launches, however the bot doesn't start, or maybe it does. I can't click on anything within the game, yet the option to pause/stop is grayed out and unclickable.

 

It's the same error if I start the client manually and select the script to be ran manually. It won't even start the login randomsolver.

 

Any help is very much appreciated! :)

Move these lines:
 

    String thebot = getParameters();
    String thebotrep = thebot.replace(' ', '\u00A0');

 

to your onStart

  • Author
18 minutes ago, d0zza said:

Move these lines:
 


    String thebot = getParameters();
    String thebotrep = thebot.replace(' ', '\u00A0');

 

to your onStart

I get a nullpointer exception here at the else if line:

        } else if (!trade.getOtherPlayer().equals(thebotrep)) {
            trade.declineTrade();
            sleep(random(450, 5000));

and i tried to log what thebot and thebotrep came out as, and they came out as 31, the first number in the parameter, say it should be "31 botter"

Edited by Nor3g

1 hour ago, Nor3g said:

import org.osbot.rs07.api.map.constants.Banks;
import org.osbot.rs07.api.ui.Message;
import org.osbot.rs07.script.Script;

import org.osbot.rs07.script.ScriptManifest;

@ScriptManifest(name = "muler", author = "Nor3g", version = 1.0, info = "muler", logo = "")

public class Muler extends Script {

    String thebot = getParameters();
    String thebotrep = thebot.replace(' ', '\u00A0');

    @Override
    public void onStart() {
        //Code here will execute before the loop is started
    }
    @Override
    public void onExit() {
        System.exit(0);
        //Code here will execute after the script ends
    }
    @Override
    public int onLoop() throws InterruptedException {
        if (!Banks.VARROCK_WEST.contains(myPosition())) {
            getWalking().webWalk(Banks.VARROCK_WEST);
        } else if (Banks.VARROCK_WEST.contains(myPosition()) && getPlayers().closest(thebotrep) != null) {
            getPlayers().closest(thebotrep).interact("Trade with");
            sleep(random(450, 5000));
        } else if (!trade.getOtherPlayer().equals(thebotrep)) {
            trade.declineTrade();
            sleep(random(450, 5000));
        } else if (!trade.getTheirOffers().contains("Coins")) {
            sleep(random(450, 5000));
        } else if (trade.getTheirOffers().contains("Coins")) {
            trade.acceptTrade();
            sleep(random(450, 5000));
        } else if (trade.isSecondInterfaceOpen()) {
            if (!trade.acceptTrade()) {
                trade.acceptTrade();
                sleep(random(450, 5000));
            }
        }
        return 100; //The amount of time in milliseconds before the loop starts over
    }

    public void onMessage(Message message) {
        if (message.getMessage().contains("Accepted trade.")) {
            stop();
        }

    }
}

 

Im trying to test out my Mulescript, but it won't start. I tried to run it with this CLI command:


java -jar "osbot 2.5.38.jar" -login Nor3g:password -bot name:pass:1234 -script muler:thebot

Or more correctly, it's a bat file that is in the same folder that the osbot client is.

The client launches, however the bot doesn't start, or maybe it does. I can't click on anything within the game, yet the option to pause/stop is grayed out and unclickable.

 

It's the same error if I start the client manually and select the script to be ran manually. It won't even start the login randomsolver.

 

Any help is very much appreciated! :)

public class Muler extends Script {

    String thebot = getParameters();
    String thebotrep;

    @Override
    public void onStart() {
    	thebotrep = thebot.replace(' ', '\u00A0');
    }

This will work

Edited by Iwin

  • Author
44 minutes ago, Iwin said:

This will work

Yes it does thank you, I've fixed it.
Only problem now is the bot stops at the second trade interface and does absolutely nothing.

else if (trade.isSecondInterfaceOpen()) {
                trade.acceptTrade();
                sleep(random(450, 5000));
        }

Im absolutely clueless as to how I'm going to fix this, all help is greatly appreciated! :)

Move that up to be the first if statement, and see what happens!

Heres a good old spoon feed of how I would do it.

Please ask whats going on so you understand! :) GL HF

if (!trade.isCurrentlyTrading()) { // Get into trading
  
  if (!Banks.VARROCK_WEST.contains(myPosition())) { // Walk to bank if we are not there
    getWalking().webWalk(Banks.VARROCK_WEST);
  }
  
  if (Banks.VARROCK_WEST.contains(myPosition()) && getPlayers().closest(thebotrep) != null) {
    if (!getPlayers().closest(thebotrep).interact("Trade with")) // Trying to trade
  		return random(450, 5000); // Trade interaction failed, returning to reset and skip everything below
    new ConditionalSleep(15000) { // Waiting 15 sec or until we have started trading
      @Override
      public boolean condition() throws InterruptedException {
        return trade.isCurrentlyTrading();
      }
    }.sleep();
    if (!trade.isCurrentlyTrading()) // Trading window not open yet!
  		return random(450, 5000); // Returning to reset and skip everything below
  }
  
}

if (!trade.getOtherPlayer().equals(thebotrep)) { // Making sure we only trade out bot
  trade.declineTrade();
  return random(450, 5000); // Returning to reset and skip everything below
}

if (!trade.isSecondInterfaceOpen() && trade.getTheirOffers().contains("Coins")) { // Waiting for coins
  trade.acceptTrade();
  new ConditionalSleep(15000) { // Wait 15 sec or until we get to the second trade interface
    @Override
      public boolean condition() throws InterruptedException {
      return trade.isSecondInterfaceOpen();
    }
  }.sleep();
}

if (trade.isSecondInterfaceOpen()) { // Accept if we are on second trade interface
  trade.acceptTrade();
}

NOT TESTED!

Edited by ItPoke
Spoon feeding

Not actually trying to help with your problem, but in future scripts you might wanna use this :)

 

It's a great guide on how to actually do task based scripting, instead of storing all of your code inside the onLoop() method.

17 hours ago, Nor3g said:

I get a nullpointer exception here at the else if line:


        } else if (!trade.getOtherPlayer().equals(thebotrep)) {
            trade.declineTrade();
            sleep(random(450, 5000));

and i tried to log what thebot and thebotrep came out as, and they came out as 31, the first number in the parameter, say it should be "31 botter"

That's because when launching through CLI the space in "31 botter" indicates that the next argument has begun.

Instead use this CLI param to run the script:
-script muler:31-botter


Then in your onstart do

    String thebot = getParameters();
    String thebotrep = thebot.replace('-', '\u00A0');

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.