Jump to content

Script not showing up even though its in the script folder


Recommended Posts

Posted

Hi all, been a while since I've been doing any sort of coding, but I wanted to script something to buy some grapes for me. Simple script but I can't get it to show up on the client. Any ideas?

 

import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import java.awt.*;

@ScriptManifest(info = "GRAPE BUYER", version = 1.0, logo = "", author = "MATT", name = "First Script")
public class main extends Script {
	
	enum State {
		OPENCHEST, BUYGRAPES, BANK, HOP;
	}

	private State state;
		
	public void onStart(){
		
	if(getInventory().isFull()){
			state = State.BANK;
	}
	
	if (getInventory().onlyContains("Coins"))
	{
		state = State.OPENCHEST;
	}
	
	if (getInventory().contains("Coins") && getInventory().contains("Grapes") && !getInventory().isFull())
	{
		state = State.BUYGRAPES;
	}
	
	if (!getStore().contains("Grapes"))
	{
		state = State.HOP;
	}
	
	
	
	}
	
	public int onLoop() throws InterruptedException{
		switch (state){
		case OPENCHEST:
			return openChest();
		case BUYGRAPES:
			return buyGrapes();
		case BANK:
			return bank();
		case HOP:
			return hopWorlds();
		}
	return random(10, 20);
	}

	int openChest() throws InterruptedException {
		objects.closest("Chest").interact("Buy-food");
		sleep(300);
		return 0;
	}

	int buyGrapes() throws InterruptedException{
		store.buy("Grapes", 10);
		sleep(300);
		return 0;
	}

	int bank() throws InterruptedException{
		getBank().depositAllExcept("Coins");
		sleep(300);
		return 0;
	
	}
	
	int hopWorlds() throws InterruptedException
	{
		getWorlds().hopToP2PWorld();
		sleep(300);
		return 0;
		
	}

}

 

Posted (edited)

Just loaded in an old NMZ script I had and it shows up. So something in the code or something? I've seen people post about SDK version but not sure how to check which one I've compiled my script with.

 

EDIT: I've also noticed Eclipse keeps making a "module" when I create a new project? I've never seen this before. Have I set something up wrong or something? Because I've noticed when I keep the module in there all my code is red, but when I delete the module then all the red disappears.

Edited by uyfgfarOS

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...