Jump to content

Cant get scripts to run


hunterl31

Recommended Posts

import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

import java.awt.*;

@ScriptManifest(author = "H", info = "My Willow Cutter", name = "H", version = 0.1, logo = "")
public class main extends Script {

	@Override
	public void onStart() {
		log("Welcome to my simple willow cutter");
	}

	private enum State {
		CUT, DROP, WAIT
	};

	private State getState() {
		Entity tree = objects.closest("Willow");
		if (!inventory.isEmpty())
			return State.DROP;
		if (tree != null)
			return State.CUT;
		return State.WAIT;
	}

	@Override
	public int onLoop() throws InterruptedException {
		log("Loop reached");
		switch (getState()) {
		case CUT:
			Entity tree = objects.closest("Willow");
			if (tree != null) {
				tree.interact("Chop down");
			}
			break;
		case DROP:
			inventory.dropAll();
			break;
		case WAIT:
			sleep(random(500, 700));
			break;
		}
		return random(200, 300);
	}

	@Override
	public void onExit() {
		log("Thanks for running my Willow cutter!");
	}

	@Override
	public void onPaint(Graphics2D g) {

	}

} 

I recently started scripting again and thought I would try and make a simple woodcutter as practice. However no matter what I do my osbot does not seem to want to run scripts. This is the code I came up with for my willow cutter, nothing special at all. I am using the latest version 2.3.106. The same happens with all of the free woodcutting scripts as well. Any ideas as to what the problem could be?

 

Edit: Before anyone asks, I am using the latest version of java, eclipse etc... and I am exporting as a jar file to the osbot scripts folder as well as adding the osbot jar to the build path in my project.

Edited by hunterl31
Link to comment
Share on other sites

I'm experiencing the same problem. I've written 3 scripts of my own, which were running completely fine just a few days ago. Now, it won't print anything when I try to log on entry to onStart() or onLoop(). The onExit() message is still printed tho, which is what I find even weirder.

 

No errors are printed to the console.

 

I've even tried stripping the code down to just

@ScriptManifest(author = "Verify", info = "SimpleTest", name = "HelloTester", version = 0, logo = "")
public class main extends Script{

    @Override
    public void onStart() {
        log("Hello, welcome to swordfish swordies service!");
       
    }

	
    @Override
    public int onLoop() throws InterruptedException {
    	log("Looping");
        return random(300, 500);
    }
    
    @Override
    public void onExit() {
        log("Goodbye.");
    }
 
    @Override
    public void onPaint(Graphics2D g) {
 
    }
}

Additional things I've tried to resolve it:

  1. Delete all scripts from osbot folder and export them again.
  2. Delete the entire osbot folder from my user directory.
  3. Running a purchased SDN script (Perfect crabs to be specific)

So far no success tho. Any help would be appreciated.

Edited by Verify
Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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...