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.

Help me with one of my first scripts please!

Featured Replies

This is my first post, im  sorry if i did something wrong. 

I am trying to write a script that makes Uncooked pizza (pizza base, cheese and tomato), and i dont know why it doesn't work. I really need some tips to make better code and make it works

 

My script:

import java.awt.Graphics2D;

import org.osbot.rs07.api.ui.RS2Widget;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

@ScriptManifest(author = "Marcelo", info = "makes cheese and tomatoes pizzas", name = "PizzaHut", version = 0, logo = "")
public class PizzaMaker extends Script {

	@Override
	public void onStart() {
		log("Let's make pizza!");
	}
	
	private enum State {
		WITHDRAW, DEPOSIT, TOMATO, CHEESE, WIDGET, NOTHING;
	}
	
	private State getState() {
		RS2Widget cooking_interface = widgets.get(270, 14);
		if(cooking_interface != null && cooking_interface.isVisible()) {
			return State.WIDGET;
		}

		if(getInventory().contains("Tomato") && getInventory().contains("Pizza base") && !bank.isOpen()) {
			return State.TOMATO;
		}
		if(getInventory().contains("Incomplete pizza") && getInventory().contains("Cheese") && !bank.isOpen()) {
			return State.CHEESE;
		}
		if(getInventory().onlyContains("Uncooked pizza")) {
			return State.DEPOSIT;
		}
		if(!getInventory().contains("Pizza base", "Cheese", "Tomato")) {
			return State.WITHDRAW;
		}
		
		return State.NOTHING;
	}
	@Override
	public int onLoop() throws InterruptedException {
		RS2Widget cooking_interface = widgets.get(270, 14);

		switch(getState()) {
		case WIDGET:
			cooking_interface.interact("Make");
	
		case TOMATO:
			if(!myPlayer().isAnimating()) {
				getInventory().interact(random(4, 7));
				sleep(random(200,400));
				getInventory().interact(random(9, 11));
				sleep(random(200, 400));
			}
	
		case CHEESE:
			if(!myPlayer().isAnimating()) {
				getInventory().interact(8);
				sleep(random(200,400));
				getInventory().interact(random(18, 20));
				sleep(random(200, 400));
			}
		
		case DEPOSIT:
			if(!bank.isOpen()) {
				bank.open();
			}
			bank.depositAll();
		
		case WITHDRAW:
			if(!bank.isOpen()) {
				bank.open();
			}
			else if(!getInventory().contains("Pizza base")) {
				bank.withdraw("Pizza base", 9);
			}
			else if(!getInventory().contains("Tomato")) {
				bank.withdraw("Tomato", 9);
			}
			else if(!getInventory().contains("Cheese")) {
				bank.withdraw("Cheese", 9);
			}
			else {
				bank.close();
			}
		case NOTHING:
			log("I DONT KNOW!");
			sleep(100);
		
			
		}
		return random(300, 700);
	}

	@Override
	public void onExit() {
		log("Done.");
	}

	@Override
	public void onPaint(Graphics2D g) {

	}

 

Not sure, but try:

getInventory.interact(SLOT, "Use");

sooo, 

getInventory().interact(random(18, 20));

should be 

 

getInventory().interact(random(18, 20),"Use");
  • Author
1 hour ago, botelias said:

Not sure, but try:

getInventory.interact(SLOT, "Use");

sooo, 


getInventory().interact(random(18, 20));

should be 

 


getInventory().interact(random(18, 20),"Use");

i want it to just left click

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.