blakdragon39 Posted February 15, 2011 Share Posted February 15, 2011 I've got spring break coming up next week and I wanna mess around trying to create an awesome slayer calculator. :D The only languages I really know are Java and procedural C++, but I'm definitely willing to learn a different one, if there's a more practical one for doing this. :) So anyways, what I want to do is be able to input the name of a user and have it return a skill's level, experience, etc. What language would be best for this? Is there maybe a tutorial that someone could point me too? I don't really have any idea of where to start! Link to comment Share on other sites More sharing options...
Hegelstad Posted February 15, 2011 Share Posted February 15, 2011 If you search these forums i remember someone made a c# api for retrieving data from hiscores or adventurers log ;) My lame drops:6 Effigys1 D Med - 1 D Dagger1 Verac's Helmet - 1 Guthan's Platebody Link to comment Share on other sites More sharing options...
obfuscator Posted February 15, 2011 Share Posted February 15, 2011 You can do it with any language really. You basically have to generate the url based on a specifc username. Jagex makes the lite hiscores available for this purpose: http://hiscore.runescape.com/index_lite.ws?player=USERNAME HERE. Replace the "username here" with whatever username you want to search for and then read in the data found on that page (split by commas). "It's not a rest for me, it's a rest for the weights." - Dom Mazzetti Link to comment Share on other sites More sharing options...
blakdragon39 Posted February 15, 2011 Author Share Posted February 15, 2011 I think I looked at that C# one, but it didn't look quite like what I was looking for. It was meant to grab the ENTIRE high scores I believe, and I just want one. You can do it with any language really. You basically have to generate the url based on a specifc username. Jagex makes the lite hiscores available for this purpose: http://hiscore.runes...player=USERNAME HERE. Replace the "username here" with whatever username you want to search for and then read in the data found on that page (split by commas). This is definitely helpful, I'll have to see where I can go with this, thanks. :D Link to comment Share on other sites More sharing options...
Markup Posted February 15, 2011 Share Posted February 15, 2011 You'll want to: Windows Sockets 2TCP ai_socktype = SOCK_STREAM;HTTP Protocol Java Python Then just string split/regex the lite hiscores Link to comment Share on other sites More sharing options...
blakdragon39 Posted February 16, 2011 Author Share Posted February 16, 2011 Using Java, all I had to do was make a URL and then a BufferedReader that reads from the URL as a stream, and I'm able to access everything from the page. I'm still looking at all those links however, as I'm interested as to how much farther I could go than just reading in simple text. xD I don't really know much about sockets/servers/clients or any of that stuff so hopefully none of this will be too over my head. ^^ Link to comment Share on other sites More sharing options...
Markup Posted February 16, 2011 Share Posted February 16, 2011 (edited) So I went searching through my old code and I found a java implementation, http://pastebin.com/Zn9qfvVQ import java.net.*; import java.io.*; import java.util.Vector; public class hiscores { public static final String searchURL = "http://hiscore.runescape.com/index_lite.ws?player="; public static final String[] skillName = {"Overall", "Attack", "Defence", "Strength", "Constitution", "Ranged", "Prayer", "Magic", "Cooking", "Woodcutting", "Fletching", "Fishing", "Firemaking", "Crafting", "Smithing", "Mining", "Herblore", "Agility", "Thieving", "Slayer", "Farming", "Runecrafting", "Hunter", "Construction", "Summoning", "Dungeoneering", "Duel Tournament", "Bounty Hunters", "Bounty Hunter Rogues", "Fist of Guthix", "Mobilising Armies", "B.A Attackers", "B.A Defenders", "B.A Collectors", "B.A Healers", "Castle Wars Games", "Conquest"}; public static final String[] skillDataName = {"Rank", "Level", "Experience"}; public static final int expVSize = skillName.length; public static void main(String[] args) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String keyboard = ""; while(true) { System.out.print("Enter rs name: "); try { keyboard = br.readLine(); if(keyboard.compareTo("`exit") == 0) break; } catch(Exception e) { System.out.println("Threw a " + e.getClass() + " with message " + e.getMessage()); } System.out.println(); try { System.out.println("Looking up hiscores . . ."); Vector stats = getHiscores(keyboard); System.out.println("Found player!"); System.out.print(rHiscoresToString(stats)); } catch(FileNotFoundException e) { System.out.println("User not found."); } catch(Exception e) { System.out.println("Threw a " + e.getClass() + " with message " + e.getMessage()); } } } public static String rHiscoresToString(Vector data) { String formatted = ""; for(int i = 0; i < expVSize; i++) { String[] get = (String[])data.get(i); formatted = formatted + "[" + skillName[i] + "] "; for(int i2 = 0; i2 < get.length; i2++) { formatted = formatted + skillDataName[i2] + ": " + get[i2] + " || "; } formatted = formatted + "\n"; } return formatted; } public static Vector getHiscores(String rsname) throws Exception { Vector data = new Vector(expVSize); URL resultsURL = new URL(searchURL + rsname); BufferedReader resultsBuffer = new BufferedReader(new InputStreamReader(resultsURL.openStream())); String current = ""; while((current = resultsBuffer.readLine()) != null) { data.add(current.split(",")); } resultsBuffer.close(); return data; } } Terrible code fyi, just a rapid code. Need to watch out for expected vector size being greater than actual, causes out of bounds although unlikely. Should add a comparison Edited March 7, 2011 by Markup Link to comment Share on other sites More sharing options...
PaoZ Posted March 7, 2011 Share Posted March 7, 2011 If u want to write the web application to grab Hiscores,I recommend PHP Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now