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.

Calling an Instance in onLoop

Featured Replies

If I were to use the following code in my onLoop it uses a lot of CPU, what would be a better option?

new ChopTrees(this);

If I were to use the following code in my onLoop it uses a lot of CPU, what would be a better option?

new ChopTrees(this);
Create it in onStart and store it globally.

I assume you have all your chopping code in the constructor, move it into a separate method and call that on the created object:

chopTreesObj.chop();

Edited by Explv

  • Author

Create it in onStart and store it globally.

I assume you have all your chopping code in the constructor, move it into a separate method and call that on the created object:

chopTreesObj.chop();

 

Okay, so I have this in a separate class (file) and in my onStart:

public class ChopTrees  {
	public void chopTrees(Script sI) {
public void onStart() {
		new ChopTrees();

What now?

ChopTrees a; // Create in parent frame

onStart() {
a = new ChopTrees(this) // Initialize in onStart
}

onLoop() {
a.<...> // Access in onLoop
}

Edit: If you have no idea what's going on

CT12aUj.png

Edited by Solzhenitsyn

Could do this, as this is what I do when I call methods from a different class

 

public class main extends Script {

Classname m = new classname();

 

onstart(){

 You can call it in the onstart class by doing this

m.(whatever method you are gonna use from the other class)

 

}

or you could call it on your onloop, or instead your switches.

 

}

Learn how to code before you copy-pasta task node systems. Also why the hell are you passing script and not the Bot instance?

 

Edit2: I deleted that tutorial

 

Too many new scripters are using those node frameworks without understanding them. There is nothing wrong with using the simple loop until you understand OOP.

 

Once you learn more about Java, you will be able to write and understand that node system. For now, just stick with learning step by step. 

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.