Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

onLoop not running?

Featured Replies

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

  • Author

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

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

what?  you are able to log in the loop, that is how i debug all of my scripts...

you messed up your bracketing somewhere, make sure every opening bracket has a closing one

  • Author

naa dude, when i take out that log output, everything is fine, So why cant i exactly use a log output in that specific location?

 

btw, I coppied my code and made a new prject and everything is working just fine now!! woohoo! biggrin.png

 

Edited by cjeee

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.