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.

Local script not appearing in selector / any problems with code

Featured Replies

Hi I am new here and trying to build my own experiments script.

When I build the jar file into the /OSBot/Scripts folder and run OSBot it does not come up in the client.

However, when the client is open and I try to delete the jar from the folder it says I cannot because it is in use.

I have copy and pasted the code to a new file but it still does not appear.

 

I am using IntelliJ to create my jar, and when I select the main class it says 'not available' but still allows me to build and reports it as successful.

 

The reason I have coded the script like this is because all AIO fighters still click the level 52 experiment, that is why I have based it on IDs not npc name, so if you think there may be issues further down the line due to this please let me know.

Cheers

import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import java.awt.*;
import javax.swing.*;

@ScriptManifest(author = "The man", info = "Experimental experiment killer", name = "Experimental experiment killer", version = 0.1, logo = "")
public class ExperimentKilla extends Script {

    public static String status;

    @Override
    public void onStart() {
        JOptionPane.showMessageDialog(null, "Welcome to my first script hello world");
    }

    private enum State {
        ATTACK1, ATTACK2, WAIT
    }

    private State getState(){
        NPC experiment1 = npcs.closest(1274);
        NPC experiment2 = npcs.closest(1275);
        if (experiment1 != null){
            return State.ATTACK2;
        }
        if (experiment2 != null){
            return State.ATTACK1;
        }
        return State.WAIT;
    }

    @Override
    public int onLoop() throws InterruptedException {
        switch(getState()){
            case ATTACK1:
                NPC experiment1 = npcs.closest(1274);

                if (experiment1 != null && !combat.isFighting() && !experiment1.isUnderAttack() && experiment1.isAttackable()) {
                    experiment1.interact("Attack");
                    status = "Attacking experiment 1";
                    sleep(random(200,800));
                }
                break;
            case ATTACK2:
                NPC experiment2 = npcs.closest(1275);
                if (experiment2 != null && !combat.isFighting() && !experiment2.isUnderAttack() && experiment2.isAttackable()){
                    experiment2.interact("Attack");
                    status = "Attacking experiment 2";
                    sleep(random(200,800));
                }

                break;
            case WAIT:
                sleep(random(299, 643));
                break;
        }
        return random(100,540);
    }

    @Override
    public void onExit(){
        JOptionPane.showMessageDialog(null, "Thanks for using.");
    }

    @Override
    public void onPaint(Graphics2D g){

    }

}

Edited by kingwill

 

Hi I am new here and trying to build my own experiments script.

When I build the jar file into the /OSBot/Scripts folder and run OSBot it does not come up in the client.

However, when the client is open and I try to delete the jar from the folder it says I cannot because it is in use.

I have copy and pasted the code to a new file but it still does not appear.

 

The reason I have coded the script like this is because all AIO fighters still click the level 52 experiment, that is why I have based it on IDs not npc name, so if you think there may be issues further down the line due to this please let me know.

Cheers

import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import java.awt.*;
import javax.swing.*;

@ScriptManifest(author = "The man", info = "Experimental experiment killer", name = "Experimental experiment killer", version = 0.1, logo = "")
public class ExperimentKilla extends Script {

    public static String status;

    @Override
    public void onStart() {
        JOptionPane.showMessageDialog(null, "Welcome to my first script hello world");
    }

    private enum State {
        ATTACK1, ATTACK2, WAIT
    }

    private State getState(){
        NPC experiment1 = npcs.closest(1274);
        NPC experiment2 = npcs.closest(1275);
        if (experiment1 != null){
            return State.ATTACK2;
        }
        if (experiment2 != null){
            return State.ATTACK1;
        }
        return State.WAIT;
    }

    @Override
    public int onLoop() throws InterruptedException {
        switch(getState()){
            case ATTACK1:
                NPC experiment1 = npcs.closest(1274);

                if (experiment1 != null && !combat.isFighting() && !experiment1.isUnderAttack() && experiment1.isAttackable()) {
                    experiment1.interact("Attack");
                    status = "Attacking experiment 1";
                    sleep(random(200,800));
                }
                break;
            case ATTACK2:
                NPC experiment2 = npcs.closest(1275);
                if (experiment2 != null && !combat.isFighting() && !experiment2.isUnderAttack() && experiment2.isAttackable()){
                    experiment2.interact("Attack");
                    status = "Attacking experiment 2";
                    sleep(random(200,800));
                }

                break;
            case WAIT:
                sleep(random(299, 643));
                break;
        }
        return random(100,540);
    }

    @Override
    public void onExit(){
        JOptionPane.showMessageDialog(null, "Thanks for using.");
    }

    @Override
    public void onPaint(Graphics2D g){

    }

}

 

Try deleting the OSBot folder, restarting OSBot, and then re-building your script.

  • Author

Will try now, should that code work?


Ok I have done that and it is still not appearing.

im having the same issue!  i deleted my osbot found in my c that has my data with the script folder.. I pasted  a couple of my old scripts in there and they never show up in the please select which script to use. i refresh and nothing.. Idk whats wrong :( i like my scripts!

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.