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

Featured Replies

Hi guys, got a script that i am NEARLY done, but now it doesnt seem to wont to work at all when i start it. Can i get you guys to have a look and see what might be the cause of it not starting?

 

cheers,

 

Gearfighter

import java.awt.Graphics2D;
import org.osbot.rs07.api.Bank;
import org.osbot.rs07.api.Inventory;
import org.osbot.rs07.api.Mouse;
import org.osbot.rs07.api.Objects;
import org.osbot.rs07.api.Settings;
import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.map.Position;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.api.model.Player;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.input.mouse.MiniMapTileDestination;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;
import org.osbot.rs07.api.ui.RS2Widget;

@SuppressWarnings("unused")
@ScriptManifest(name = "Gearz Pizza Maker", author = "Gearfighter", version = 1.0, info = "About your script", logo = "Logo of your script. Imgur links here [DIRECT LINKS ONLY]")
public class GearzPizzaMaker extends Script {
	public void makeAll() throws InterruptedException {
		RS2Widget PizzaWidget;
		PizzaWidget = getWidgets().get(309, 6);
		if (PizzaWidget != null && PizzaWidget.isVisible())
			if (PizzaWidget.interact("Make all"))
				sleep(18000);
	}

	public void onStart() {
		log("Ima Make some a Pizza");
	}

	private enum State {
		Bank, Banka, Bankb, Bank1, Bank1a, Pizza, Bank2, Pizza2, Bank3
	}

	private State getState() {

		if (getInventory().isEmpty() && !getBank().contains("Incomplete pizza")) {
			return State.Bank;
		}
		if (getInventory().contains("Pizza base") && getInventory().contains("Tomato")) {
			return State.Pizza;
		}
		if (getInventory().contains("Incomplete pizza") && !getInventory().contains("Cheese")) {
			return State.Bank1;
		}
		if (getInventory().contains("Incomplete pizza") && getInventory().contains("Cheese")) {
			return State.Pizza2;
		}
		if (getInventory().contains("Uncooked pizza")) {
			return State.Bank2;
		}
		if (getBank().contains("Incomplete pizza")) {
			return State.Bank3;
		}
		if (getInventory().onlyContains("Tomato")) {
			return State.Banka;
		}
		if (getInventory().onlyContains("Pizza base")) {
		return State.Bankb;
		}
		if (getInventory().onlyContains("Cheese")) {
		return State.Bank1a;
		}
		
		return null;
		}
	
	@[member=Override]
	public void onExit() {
		// Code here will execute after the script ends
		// Examples: logs, listeners, or dynamic sig data. Really anything that
		// needs to be ended when the user of your script stops it.
		log("Script ended! Please leave feedback on the forums");
	}

	@[member=Override]
	public int onLoop() throws InterruptedException {
		switch (getState()) {

		case Bank:
				if (!getBank().isOpen()) {
					getBank().isOpen();
					getBank().withdraw("Pizza base", 14);
				if (getInventory().contains("Pizza base"))
					;
				sleep(1000);
				getBank().withdraw("Tomato", 14);
				getBank().close();
				}
				break;
  
		case Banka:
			if (!getBank().isOpen()) {
				getBank().open();
					getBank().withdraw("Pizza base", 14);
					getBank().close();	
			}
			break;
			
			case Bankb:
				if (!getBank().isOpen()) {
					getBank().open();
					getBank().withdraw("Tomato", 14);
				getBank().close();
				}
				break;
				
		case Pizza:
				if (getInventory().getItem("Pizza base").interact("Use", "Pizza base"))
					if (getInventory().getItem("Tomato").interact("Use", "Tomato"))
						sleep(3000);
			makeAll();

			break;

		case Bank1:
			if (!getBank().isOpen()) {
				getBank().open();
				getBank().withdraw("Cheese", 14);
				getBank().close();
			}
			break;
			
		case Bank1a:
			if (!getBank().isOpen()) {
				getBank().open();
					getBank().withdraw("Incomplete pizza", 14);
					getBank().close();	
			}
			break;
			

		case Bank2:
			if (!getBank().isOpen()) {
				getBank().open();
				getBank().depositAll();

			}
			break;

		case Pizza2:
			if (getInventory().getItem("Incomplete pizza").interact("Use", "Incomplete pizza"))
				if (getInventory().getItem("Cheese").interact("Use", "Cheese"))
					sleep(3000);
			makeAll();
		case Bank3:
			if (!getBank().isOpen()) {
				getBank().open();
				sleep(800);
				getBank().withdraw("Incomplete pizza", 14);
				if (getInventory().contains("Incomplete pizza"));
				sleep(1000);
				getBank().withdraw("Cheese", 14);
				getBank().close();
			}
			break;
		}
		return 0;
	}
}

Do some debugging, like does it loop? Does getState() return anything? It could be a problem with your logic when finding the state, so it returns null.

And I'm pretty sure you can't just check whether your bank contains a certain thing if it isn't open.

TBH you should redo getState completely, split it into logical steps.

if (!getBank().isOpen()) {
	getBank().isOpen();

wat

 

And use conditional sleeps, or at least use regular sleeps.

				if (!getBank().isOpen()) {
					getBank().open();
					getBank().withdraw("Tomato", 14);
				getBank().close();

sleeeeeep

 

If ya need any help holla

Edited by Auron

public void makeAll() throws InterruptedException {
		RS2Widget PizzaWidget;
		PizzaWidget = getWidgets().get(309, 6);
		if (PizzaWidget != null && PizzaWidget.isVisible())
			if (PizzaWidget.interact("Make all"))
				sleep(18000);
	}

For this part i don't recommend using static widgets as sometimes if something got updated it would change the widget IDs.

if (getInventory().isEmpty() && !getBank().contains("Incomplete pizza")) {

            return State.Bank;

        }

 

The red text would return a null if the bank is not opened i think

if (getBank().contains("Incomplete pizza")) {

            return State.Bank3;

        }

 

Same for this

Thanks for all your help and ideas, my script is now working again!

 

What exactly did you do? I am having the same issue as you and i can't seem to figure out what the problem is.

  • Author

@@CloudCode

 

I have cleaned up my code a bit since this post, if you want, private message me your code and i can help you out where i can :)

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.