Skip 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.

Spork's Simple GE Dumper

Featured Replies

A buddy of mine requested this over Skype, and as I already had it written as a CLI app, I just converted it to work with OSBot. I guess it's nice for the GUI but not very resource friendly haha.

 

The script iterates through IDs on the GE, checking if it's valid or nah, and then simply log()'s them. Pls write your own logger if you actually want to make use of it lmao.

 

EDIT/WARN: Due to osrs website, this code currently does not work. Will have to change useragent later on and probably use Apache's web lib in further edits. Pls donot use dis for anything other than an example. :D

 

Jar: http://www.filedropper.com/osgedump

 

Code:

package main;

import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

import java.awt.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@ScriptManifest(name = "Simple GE Dumper", author = "Spork", version = 13.37, info = "Creates prices.txt...", logo = "")

public class Main extends Script {

	/*
	 * Simple GE Dumper
	 * Should start running at item 0, which is invalid anyway...
	 * Good luck!
	 */
	
	String BASE_URL = "http://services.runescape.com/m=itemdb_oldschool/lookup/viewitem?obj=";

	int itemId;
	State state;

	public enum State {
		STARTUP, VALID, INVALID, ERROR
	}

	@[member='Override']
	public void onStart() {
		state = State.STARTUP;
		itemId = 0;

	}

	@[member='Override']
	public void onExit() {
		//Maybe gonna put logging here.
	}

	@[member='Override']
	public int onLoop() {
		try (final BufferedReader reader = new BufferedReader(//Creates BufferedReader
				new InputStreamReader(new URL(new StringBuffer(BASE_URL).append(itemId).toString()).openStream()))) { //Creates InputStream for the URL to GE appending itemId onto it

			if (reader.toString().contains("Sorry, there was a problem with your request.")) {
				state = State.INVALID; //The item is unavailable or not a tradable item
			} else {
				state = State.VALID; //WOO
				String name = getBetween(reader.toString(), "<title>", " - "); //Most useful function: getBetween()
				String price = getBetween(reader.toString(), "Current Guide Price <span title='", "'");
				log(name + " " + price); //TODO: Logging to file
			}
		} catch (MalformedURLException e) {
			state = State.ERROR;
		} catch (IOException e) {
			state = State.ERROR;
		}
		if (state == State.ERROR) {
			try {
				sleep(5000); //Sleep for a while so you can look at it and be like ?? y
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		itemId++;//Next iteration
		return 100;
	}

	@[member='Override']
	public void onPaint(Graphics2D g) {
		// This is where you will put your code for paint(s)

		g.drawString("Status: " + state, 30, 300);
		g.drawString("Checking Item: " + itemId, 30, 280);

	}

	public static String getBetween(String haystack, String pre, String post) {
		Pattern pattern = Pattern.compile(Pattern.quote(pre) + "(.+?)" + Pattern.quote(post));
		Matcher matcher = pattern.matcher(haystack);

		if (matcher.find()) {
			return haystack.substring(matcher.start(1), matcher.end(1));
		}

		return "No match could be found.";
	}
}

Edited by Spork

  • 2 weeks later...

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.