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

Seperate classes, wat am i doing wrong?

Featured Replies

Hey everyone.

 

I'm trying to use different classes for different quests. This is because i'm trying to make myself a questing script.

 

What do i do wrong? I have 2 classes. The first is ofcourse the main class, second class is "SheepShearer".

 

This is my code:

package core;
	import org.osbot.rs07.api.model.Entity;
	import org.osbot.rs07.script.Script;
	import org.osbot.rs07.script.ScriptManifest;
	import quests.SheepShearer;

import java.awt.*;

	@ScriptManifest(author = "Sebastian", info = "Quest like you've never quested before!", name = "JSQuester", version = 0, logo = "")
	public class Main extends Script {

		@[member='Override']
		public void onStart() {
			log("Started");
		}

		private enum State {
			SHEEPSHEARER, WAIT, QUESTTWO
		};

		private State getState() {
			if (myPlayer().isAnimating())
				return State.SHEEPSHEARER;
			return State.WAIT;
		}

		@[member='Override']
		public int onLoop() throws InterruptedException {
			switch (getState()) {
			case SHEEPSHEARER:
					new SheepShearer(this);
				break;
			case QUESTTWO:
				break;
			case WAIT:
				break;
			}
			return random(200, 300);
		}

		@[member='Override']
		public void onExit() {
			log("Stopped script..");
		}

		@[member='Override']
		public void onPaint(Graphics2D g) {

		}

	} 

package quests;

import org.osbot.rs07.script.Script;

public class SheepShearer {

public SheepShearer(Script Quest_SheepShearer) throws InterruptedException {
	
		Quest_SheepShearer.log("test");	
	}
}

I can't get it to log the "test". What am i doing wrong?

 

EDIT:

 

Nevermind, for some reason it works now...

[INFO][Bot #2][09/09 08:55:15 PM]: Started script : JSQuester
[INFO][Bot #2][09/09 08:55:15 PM]: test
[INFO][Bot #2][09/09 08:55:16 PM]: test
[INFO][Bot #2][09/09 08:55:16 PM]: test
[INFO][Bot #2][09/09 08:55:16 PM]: test
[INFO][Bot #2][09/09 08:55:16 PM]: test
[INFO][Bot #2][09/09 08:55:17 PM]: test
[INFO][Bot #2][09/09 08:55:17 PM]: test
[INFO][Bot #2][09/09 08:55:17 PM]: test
[INFO][Bot #2][09/09 08:55:17 PM]: test

Edited by Sebastian

Hey everyone.

 

I'm trying to use different classes for different quests. This is because i'm trying to make myself a questing script.

 

What do i do wrong? I have 2 classes. The first is ofcourse the main class, second class is "SheepShearer".

 

This is my code:

package core;
	import org.osbot.rs07.api.model.Entity;
	import org.osbot.rs07.script.Script;
	import org.osbot.rs07.script.ScriptManifest;
	import quests.SheepShearer;

import java.awt.*;

	@ScriptManifest(author = "Sebastian", info = "Quest like you've never quested before!", name = "JSQuester", version = 0, logo = "")
	public class Main extends Script {

		@[member='Override']
		public void onStart() {
			log("Started");
		}

		private enum State {
			SHEEPSHEARER, WAIT, QUESTTWO
		};

		private State getState() {
			if (myPlayer().isAnimating())
				return State.SHEEPSHEARER;
			return State.WAIT;
		}

		@[member='Override']
		public int onLoop() throws InterruptedException {
			switch (getState()) {
			case SHEEPSHEARER:
					new SheepShearer(this);
				break;
			case QUESTTWO:
				break;
			case WAIT:
				break;
			}
			return random(200, 300);
		}

		@[member='Override']
		public void onExit() {
			log("Stopped script..");
		}

		@[member='Override']
		public void onPaint(Graphics2D g) {

		}

	} 

package quests;

import org.osbot.rs07.script.Script;

public class SheepShearer {

public SheepShearer(Script Quest_SheepShearer) throws InterruptedException {
	
		Quest_SheepShearer.log("test");	
	}
}

I can't get it to log the "test". What am i doing wrong?

 

because you need to make an instance of the class for that to be executed in the onStart()

yeah it worked because you made a new instance and called the log in the constructor

Edited by Precise

  • Author

because you need to make an instance of the class for that to be executed in the onStart()

 

yeah it worked because you made a new instance and called the log in the constructor

 

Thanks for your reply. For some reason it worked after i posted this thread.. I didn't change anything in the onStart() tbh.

 

 

Edited by Sebastian

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.