Jump to content

onLoop not running?


cjeee

Recommended Posts

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

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