View Full Version : Need help grabbing and splitting some values from a site

Mr Blah Man
08-21-2009, 04:31 AM
Alright, so I'll be honest, I HAVE NO IDEA ABOUT JAVASCRIPT! So, basically, I want, when the button is clicked, for this to grab some levels from a game and do some calculations. Simple. Well... Not for me. Here is the code I have right now:

<script language="JavaScript" type="text/javascript">
function GrabTheStats(rsusername){
var GrabStats = ""http://hiscore.runescape.com/index_lite.ws?player="" + rsusername;
var GrabStats_array = GrabStats.split(",");
attLvl = expToLevel(GrabStats_array[0],false);
strLvl = expToLevel(GrabStats_array[1],false);
defLvl = expToLevelGrabStats_array[2],false);
hpLvl = expToLevel(GrabStats_array[3],true);
magLvl = expToLevel(GrabStats_array[4],false);
ranLvl = expToLevel(GrabStats_array[5],false);
praLvl = expToLevel(GrabStats_array[6],false);
sumLvl = expToLevel(GrabStats_array[7],false);
calcResult = calcCombat(attLvl,strLvl,defLvl,hpLvl,magLvl,ranLvl,praLvl,sumLvl);
document.getElementById('outputlocation').value = calcResult[0] + "/" + calcResult[1];

<input type="text" name="outputlocation" id="outputlocation"/>
<input type="button" onclick="GrabTheStats("zezima");" value="CLICK ME" />

Could someone help me to get this working? The calcCombat calculates things bases on the levels it grabs and produces an array of results, calcResult[0] and [1] being the two results I want right now. An example output will hopefully be "95/98".

Please don't criticize, since this is for 'crappy old RuneScape'. It really doesn't help.