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.

Script not doing anything once its started [Noob Help]

Featured Replies

So I got this simple "Man" pick pocketer. It should just steal from the men in lumby and thats it. (Just starting out)

 

However once its started it doesn't do anything. If anyone can spot any errors in the code then please help me out

 

Code:

 

import org.osbot.rs07.api.model.NPC;

import org.osbot.rs07.script.Script;

import org.osbot.rs07.script.ScriptManifest;



import java.awt.*;



@ScriptManifest(name = "SuperPickpocket", author = "Sean", info = "My first script",version = 0, logo = "")

public class SuperPickpocket extends Script {



private NPC man;



@Override

public void onStart() {

log("Welcome to my Trial Script (Thieving)");

man = npcs.closest("Man");

}



private enum State {

PICKPOCKET, WAIT;

};



private State getState() {

if (man != null)

return State.PICKPOCKET;

return State.WAIT;

}



@Override

public int onLoop() throws InterruptedException {

switch (getState()) {

case PICKPOCKET:

man.interact("Pickpocket");

break;

case WAIT:

sleep(random(400, 600));

break;

}

return random(200, 300);

}



@Override

public void onExit() {

log("Thx for using this script");

}



@Override

public void onPaint(Graphics2D g) {



}




}

 

  • Author

Your man variable is most likely null resulting in always waiting. You should search for a man in onLoop() not onStart(). 

Fixed it was getting this error 

 

java.lang.NoClassDefFoundError: SuperPickpocket$1
 
 
Didn't copy all the files over. But before that I changed all the "man" variables to "Man" as its case sensitive right?

 

Fixed it was getting this error 

 

java.lang.NoClassDefFoundError: SuperPickpocket$1
 
 
Didn't copy all the files over. But before that I changed all the "man" variables to "Man" as its case sensitive right?

 

Java is case sensitive so it's the same if you name your variables "man" or "Man". It only matters that you use the same everywhere in your code.

Its awesome that youre taking this so seriously! :)

 

Firstly, ensure that you run the script with the OSBot console open (aka logger).

 

Secondly, the reason this is happening is because it's throwing NPEs (null pointer errors).

To fix this, just re-define the man variable in the onLoop and getState functions (basically, always search for a new object before interacting). 

 

~apa

  • Author

Its awesome that youre taking this so seriously! smile.png

 

Firstly, ensure that you run the script with the OSBot console open (aka logger).

 

Secondly, the reason this is happening is because it's throwing NPEs (null pointer errors).

To fix this, just re-define the man variable in the onLoop and getState functions (basically, always search for a new object before interacting). 

 

~apa

Thx man. I used your tutorial to get the basics setup and the layout :P

Guest
This topic is now closed to further replies.

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.