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.

Generic Bot settings snippet [EASY]

Featured Replies

Presenting you easy generic SAVE/LOAD implementation, feel free to use :

 

 (some of the Load and Save class implementations are copypasted from help section)

 

Save Class:

import java.io.*;
import java.util.Base64;

public class Save {
    
    private PrintWriter pw;

    String localDir = System.getProperty("user.home") + File.separator + "OSBot" + File.separator + "data" + File.separator;

    public Save(String localName) {
        try {
            pw = new PrintWriter(localDir + localName + ".ini");
            System.out.println(pw.toString() + "\n" + localDir);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    public boolean writeString(String s) {
        pw.println(s);
        pw.close();
        return true;
    }

    public boolean writeObject(Serializable o) throws IOException {
        writeString(toString(o));
        System.out.println(toString(o));
        return true;
    }

    private static String toString(Serializable o) throws IOException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(o);
        oos.close();
        return Base64.getEncoder().encodeToString(baos.toByteArray());
    }
}

Load class:

import java.io.*;
import java.nio.charset.Charset;
import java.util.Base64;

public class Load {

    private BufferedReader br;
    private InputStream fis;
    private InputStreamReader isr;
    private boolean finished = false;

    String localDir = System.getProperty("user.home") + File.separator + "OSBot" + File.separator + "data" + File.separator;

    public Load(String localName) {
        try {
            fis = new FileInputStream(localDir + localName + ".ini");
            isr = new InputStreamReader(fis, Charset.forName("UTF-8"));
            br = new BufferedReader(isr);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    public String readLine() throws IOException {
        String line = null;
        if (!finished) {
            line = br.readLine();
            if (line == null) finished = true;
        }
        else {
            if (br != null) {
                br.close();
                fis.close();
                isr.close();
                br = null;
            }
        }
        return line;
    }


    public Object readObject() throws IOException, ClassNotFoundException {
        return fromString(readLine());
    }

    private static Object fromString( String s ) throws IOException ,
            ClassNotFoundException {
        byte [] data = Base64.getDecoder().decode( s );
        ObjectInputStream ois = new ObjectInputStream(
                new ByteArrayInputStream(  data ) );
        Object o  = ois.readObject();
        ois.close();
        return o;
    }
}

How it works?

 

 

FOR SAVING

All you have to do is create a Save class that you are going to use:

Save save = new Save("Filename");

And saving class that contains information about your bot:

//make sure that your Properties class implements "Serializable"
Properties propertiesofBot = new Properties("My properties class");

save.writeObject(propertiesofBot);

FOR LOADING:

//Make sure you create Load class with same name as the Save class
Load load = new Load("Filename");  

And all you need to do is load and save the class to the variable

Properties properties = (Properties) load.readObject();

Saving or loading classes that differ is not supported.

 

Hope this helps! smile.png

Edited by Aces_

I don't wana be that guy but 

Script#getDirectoryData()

emote3.png

 

 

 

Nice snippet though

Edited by House

  • Author

I don't wana be that guy but 

Script#getDirectoryData()

emote3.png

 

 

 

Nice snippet though

It is outside the Script file so I've left it like this 

Edited by Aces_

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.