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 wont start

Featured Replies

Today I was testing some stuff and tried to make a new script that basically makes flour in the cooking guild. But my problem is that the script wont even start, I tried out to see if onStart will function but not even that works. Looked at some of my other scripts and I don't see why it wont start.

And when i run the script I cant control the player anymore

My code (A mess ik):

package flourMaker;

import org.osbot.rs07.api.Bank;
import org.osbot.rs07.api.Inventory;
import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.model.Player;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

@ScriptManifest(author = "TorRS", info = "Makes Flour", name = "Flour Maker", version = 0, logo = "")
public class Main extends Script {

    boolean tray = false;
    boolean con = false;
    boolean shouldGrain;
    boolean finishedGrain;

    final Area BANK_AREA = new Area(3167, 3490, 3169, 3489);
    final Area GUILD_TRAY = new Area(3142, 3449, 3146, 3446);
    final Area GUILD_HOPPER = new Area(3140, 3452, 3143, 3450).setPlane(2);

    final int BANK_BOTH_ID = 10060;
    final int GRAIN_ID = 1947;

    final String HOPPER_NAME = "Hopper";
    final String CONTROLS_NAME = "Hopper controls";

    Inventory inventory = getInventory();
    Player player = myPlayer();
    Bank bank = getBank();

    @Override
    public void onStart() throws InterruptedException {
        log("We are off");
        super.onStart();
    }

    @Override
    public int onLoop() throws InterruptedException {

        if (inventory.isFull() && inventory.contains(GRAIN_ID)) {
            shouldGrain = true;
        }

        if (tray == false) {
            if (shouldGrain == true) {
                if (GUILD_HOPPER.contains(player)) {
                    if (inventory.contains(GRAIN_ID)) {
                        Entity hopper = getObjects().closest(HOPPER_NAME);
                        Entity controller = getObjects().closest(CONTROLS_NAME);
                        if (con == false) {
                            if (hopper != null) {
                                if (hopper.isVisible()) {
                                    if (!player.isAnimating()) {
                                        if (!player.isMoving()) {
                                            hopper.interact("Fill");
                                            sleep(random(1500, 2000));
                                            con = true;
                                        }
                                    }
                                } else {
                                    getCamera().toEntity(hopper);
                                }
                            }
                        } else {
                            if (controller != null) {
                                if (controller.isVisible()) {
                                    if (!player.isAnimating()) {
                                        if (!player.isMoving()) {
                                            controller.interact("Operate");
                                            sleep(random(1500, 2000));
                                            con = false;
                                        }
                                    }
                                }
                            }
                        }
                    } else {
                        tray = true;
                        shouldGrain = false;
                    }
                } else {
                    getWalking().webWalk(GUILD_HOPPER);
                }
            } else {
                if (BANK_AREA.contains(player)) {
                    Entity bankbooth = getObjects().closest(BANK_BOTH_ID);

                    if (bank.isOpen()) {
                        bank.withdrawAll(GRAIN_ID);
                    } else {
                        if (bankbooth != null) {
                            if (bankbooth.isVisible()) {
                                bankbooth.interact("Bank");
                                sleep(random(2000, 3000));
                            } else {
                                getCamera().toEntity(bankbooth);
                            }
                        }
                    }
                } else {
                    getWalking().webWalk(BANK_AREA);
                }
            }
        } else {
            // Get pots and empty tray
        }

        return random(400, 600);
    }

    @Override
    public void onExit() throws InterruptedException {
        log("WE out");
        super.onExit();
    }

}

Edited by TorRS

These have not been "made"  yet. Best pratice is to use getters and setters.

But this will fix it.

Inventory inventory ;
Player player ;
Bank bank;

@Override
public void onStart() throws InterruptedException {
    log("We are off");
     inventory = getInventory();
     player = myPlayer();
     bank = getBank();

}

Other Things I see.

you dont need to say if ( bool == true) it is alreday true so you just if(bool) and you dont to say if(bool  == false ) just say if( !bool)

Also look into varbits and piotion oriented acctions. 

if 2 bots are on the same world this will break.

 

 

  • Author
9 hours ago, Nbacon said:

Also look into varbits and piotion oriented acctions. 

if 2 bots are on the same world this will break.

Got any link where i can read into this, if u dont mind

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.