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.

Question [Noob Scripter Starting Out]

Featured Replies

Was following this tutorial so shoutout to Apaec 

 

Bascially changing it up to make it pickpocket men in lumby.

 

Problem I'm having currently is that the script won't start when I press the play button. So it doesn't run.

 

 

Code here since people said post it tongue.png

 

import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;



import java.awt.*;
import java.lang.Thread.State;

@ScriptManifest(author = "Sean", info = "My first script", name = "Man Pickpocketer", version = 0, logo = "")
public class main extends Script {

@Override
public void onStart() {
log("Welcome to my Trial Script (Thieving)");
}

private enum State {
     PICKPOCKET, WAIT;
};

private State getState(){
NPC Man = npcs.closest("Man");
if (Man != null)
return State.PICKPOCKET;
return State.WAIT;
}
@Override
public int onLoop() throws InterruptedException {
switch (getState()) {
case PICKPOCKET:
NPC Man = npcs.closest("Man");
if (Man !=null) {
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) {

}

}
 

Edited by Sean001

You could probably just post your code here. I don't see why you're protective of a lumby pickpocker that (maybe) doesn't work. Unless you really don't want anyone to see it tongue.png

Edited by Shudsy

  • Author

You could probably just post your code here. I don't see why you're protective of a lumby pickpocker that doesn't work. Unless you really don't want anyone to see it tongue.png

I could but don't want to embarrass myself if I did something retarded lol

Edited by Sean001

I could but don't want to embarrass myself if I did something retarded lol

If you're just starting out it doesn't really matter? take priority in learning over your one day of java pride.

 

If you're starting out we expect to see faults in the code anyway.

I'm just guessing that you dont have your ScripManifest tongue.png

@ScriptManifest ...

class test extends Script{
}

You will need to import it and add the methods. boge.png

 

And post your code, people are glad to help others, no shame in what you have. We will give you tips etc. :)

Edited by Vilius

Post code || make sure you have a ScriptManifest

//Example
@ScriptManifest(author = "Sinatra", name = "Trinity Dragons", info = "", logo = "http://i.imgur.com/MCq1qNX.png", version = 5.5)
  • Author

If you're just starting out it doesn't really matter? take priority in learning over your one day of java pride.

 

If you're starting out we expect to see faults in the code anyway.

 

 

I'm just guessing that you dont have your ScripManifest tongue.png

@ScriptManifest ...

class test extends Script{
}

You will need to import it and add the methods. boge.png

 

And post your code, people are glad to help others, no shame in what you have. We will give you tips etc. smile.png

 

 

 

Post code || make sure you have a ScriptManifest

//Example
@ScriptManifest(author = "Sinatra", name = "Trinity Dragons", info = "", logo = "http://i.imgur.com/MCq1qNX.png", version = 5.5)

posted code

Man is a NPC not a object. NPC man = npcs.closest("man");

 

You're also missing a " after your name in the manifest.

Edited by Shudsy

  • Author

Man is a NPC not a object. NPC man = npcs.closest("man");

 

You're also missing a " after your name in the manifest.

Thank you changed that but the script still doesn't show up as a local script on the osbot client which is my main issue.

 

Edit: I see alot of red "X" by the lines of my code. Is that an issue? (assuming) 

Edited by Sean001

Thank you changed that but the script still doesn't show up as a local script on the osbot client which is my main issue.

 

And you've compiled your script and put the .jar file in the osbot folder?

  • Author

And you've compiled your script and put the .jar file in the osbot folder?

 

Yea I put it here

 

C:\Users\Sean\OSBot\Scripts\TrialScript.jar

 

Also got an "x" here though

 

2ddce60faaf8fcaaa33b1b6515285f69.png


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

import org.osbot.rs07.script.Script;

import org.osbot.rs07.script.ScriptManifest;

import java.awt.*;

import java.lang.Thread.State;

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

public class main extends Script {

@Override

public void onStart() {

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

}

private enum State {

PICKPOCKET, WAIT;

};

private State getState(){

NPC Man = npcs.closest("Man");

if (Man != null)

return State.PICKPOCKET;

return State.WAIT;

}

@Override

public int onLoop() throws InterruptedException {

switch (getState()) {

case PICKPOCKET:

NPC Man = npcs.closest("Man");

if (Man !=null) {

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
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
 


import java.awt.*;
import java.lang.Thread.State;
 
@ScriptManifest(author = "Sean", info = "My first script", name = "Man Pickpocketer", version = 0, logo = "")
public class main extends Script {
 
    @Override
    public void onStart() {
        log("Welcome to my Trial Script (Thieving)");
    }

    private enum State {
    	 PICKPOCKET, WAIT;
    };
    
    private State getState(){
     NPC Man = npcs.closest("Man");
     if (Man != null)
     return State.PICKPOCKET;
     return State.WAIT;
    }
     @Override
    public int onLoop() throws InterruptedException {
     switch (getState()) {
     case PICKPOCKET:
     NPC Man = npcs.closest("Man");
     if (Man !=null) {
     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) {
 
    }
 
}

Thx for the corrections :)

Figured out why it wasn't appearing on my scripts list so that's fixed.

 

Only problem Im having now is it won't start when I press the play button.

Thx for the corrections smile.png

Figured out why it wasn't appearing on my scripts list so that's fixed.

 

Only problem Im having now is it won't start when I press the play button.

 

If you're looking for help then you need to start giving more specific questions. "Not starting" doesn't really help. Does the script start but it stands there and does nothing? or you cant even start it? put logs on your states and see if they log.

Edited by Shudsy

  • Author

If you're looking for help then you need to start giving more specific questions. "Not starting" doesn't really help. Does the script start but it stands there and does nothing? or you cant even start it? put logs on your states and see if they log.

When I press the play button. The script in general doesn't start so nothing happens. I don't get the stop button appearing so I can't even start it.

 

Edit: Im off pc now so any code changes will need to happen tomorrow.

Edited by Sean001

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.