- Joined
- Jan 21, 2007
- Sythe Gold
- 1,234
- Messages
- 14,211
I made this to practice to make a program that takes two or three skills and finds the name of the person... It just shows levels, not XP or rank since it would be annoying to be rank and XP in a console read out. Lol.
For some reason all the closing brackets turned into **s...
Thank you Sun website, Google, and Swans HTML downloading code which I used to figure out how to do all of this.
For some reason all the closing brackets turned into **s...
Code:
package suf;
import java.net.*;
import java.io.*;
import java.util.*;
public class NameLookUp
{
static Scanner s = new Scanner(System.in);
public static String data = "";
public static String[] skills =
{ "Overall", "Attack", "Defence", "Strength", "Hitpoints", "Ranged", "Prayer", "Magic", "Cooking", "WoodCutting", "Fletching", "Fishing", "Firemaking",
"Crafting", "Smithing", "Mining", "Herblore", "Agility", "Thieving", "Slayer", "Farming", "Runecrafting", "Hunter", "Construction", "Summoning" **;
public static void main(String[] args)
{
parser(connect());
**
public static String connect()
{
while (true)
{
try
{
String player = getInput("Username:");
URL site = new URL("http://hiscore.runescape.com/index_lite.ws?player=" + player);
String html;
BufferedReader in = new BufferedReader(new InputStreamReader(site.openStream()));
while ((html = in.readLine()) != null)
{
if (data.equals(""))
{
data = html;
**
else
{
data = data + "," + html;
**
**
return (data);
**
catch (MalformedURLException exc)
{
System.out.println("Error!");
**
catch (IOException exc)
{
System.out.println("That user does not have any high scores listed. Please pick another player.");
**
**
**
public static void parser(String input)
{
try
{
int skillnum = 0;
StringTokenizer a = new StringTokenizer(input, ",");
while (skillnum < 25)
{
a.nextToken();
System.out.print(skills[skillnum] + ": ");
String check = a.nextToken();
if (check.equals("-1"))
{
System.out.println("Not Ranked");
**
else
{
System.out.println(check);
**
skillnum++;
a.nextToken();
**
**
catch (NoSuchElementException e)
{
System.out.println("Error!");
**
**
public static String getInput(String output)
{
while (true)
{
try
{
System.out.print(output);
return s.next();
**
catch (InputMismatchException e)
{
s.next();
**
**
**
**
Thank you Sun website, Google, and Swans HTML downloading code which I used to figure out how to do all of this.













