Jump to content
uyfgfarOS

Script not showing up even though its in the script folder

Recommended Posts

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;
		
	}

}

 

Link to post
Share on other sites
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
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...