Jump to content

onLoop not running?


Recommended Posts

Posted (edited)

EDIT: PROBLEM SOLVED, I JUST HAD TO CREATE A NEW PROJECT FILE

 

I added a Log output within the onLoop method to see what is running and such, and im not recieving any output. My script isnt doing anything either. Maybe its the way i compiled it? I added the OSBot Jar to the build path, and Im using Eclipse.

 

This Code was modified from this tutorial:

http://osbot.org/forum/topic/58775-a-beginners-guide-to-writing-osbot-scripts-where-to-get-started-by-apaec/

 

I would really like to know what I am doing thats wrong. Please let me know ASAP, thanks smile.png

 

Heres my simple ass code:

import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

import java.awt.*;


@ScriptManifest(name = "Droppa", author = "Daddy", version = 6.999999, info = "", logo = "") 
public class main extends Script {




    @Override
    public void onStart() {
        //Code here will execute before the loop is started
    	log("Welcome to my script!!!");
    	
    }
    
    private enum State {
		DROP, WAIT
	};
	
	private State getState() {
		if (!inventory.isEmpty())
			return State.DROP;
		return State.WAIT;
	}
 
    @Override
    public int onLoop() throws InterruptedException {
		log("Running onLoop...");
		switch (getState()) {
		log("Getting State...");
		case DROP:
			inventory.dropAll();
			log("Dropping...");
			break;
		case WAIT:
			log("Waiting...");
			sleep(random(50, 60));
			break;
		}
		return random(200, 300);
	}

    @Override
    public void onExit() {
        //Code here will execute after the script ends
    	log("Thanks!!!");
    	
    }

    @Override
    public void onPaint(Graphics2D g) {
        //This is where you will put your code for paint(s)




    }


}
Edited by cjeee
Posted (edited)

Nvm im dumb, i guess i cant add a log there because it messes with the decompiler lmao

 

Edit: is there any way to get a log output between

		switch (getState()) {

		case DROP:

within

    @Override
    public int onLoop() throws InterruptedException {
		log("Running onLoop...");
		switch (getState()) {

		case DROP:
			inventory.dropAll();
			log("Dropping...");
			break;
		case WAIT:
			log("Waiting...");
			sleep(random(50, 60));
			break;
		}
		return random(200, 300);
	}

i want to log it but i get a compiling error

Edited by cjeee

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