PHP RuneScape stat function.
PHP Code
+ 0 likes
Please Register to submit score.
| Average Score | 8.6 |
| Scores Submitted | 5 |
| Date Added | Sep 18, 2007 |
| Last Updated | Sep 18, 2007 |
| Tags | function rune runescape scape script stat stats |
|
|
Introduction
$variable = getStats("RussellReal");
and you will get a two dimensional array.
$variable[$skill][$aspect];
$aspect would be "Level" or "Exp" or "Rank"
so for example: $variable["Strength"]["Level"]; will return 89, which is RussellReals Strength Level :P
not really for looping through the values, unless you use foreachs like so:
foreach ($variable as $skill => $v) {
$line = $skill;
foreach ($variable[$skill] as $aspect => $data) {
$line .= " ".$aspect.": ".$data;
}
echo $line."\\n";
}
will print a readable version of the multidimensional array. :)
will return "false" if the username doesn't exist. and somewhere in the aspects of the second dimension of the arrays will be Not Ranked. for whichever skill the user isn't ranked in. Enjoy :)
PHP Snippet:
PHP RuneScape stat function.
Posted on Sep 18, 2007 12:23 pm
Posted on Sep 18, 2007 12:23 pm
so what do i do to view stats? i dont get it
PHP Snippet:
PHP RuneScape stat function.
Posted on Sep 18, 2007 2:57 pm
Posted on Sep 18, 2007 2:57 pm
sleek as usual m8, cause there are noobs who grade all scripts 1, ill give you a 10! :)
PHP Snippet:
PHP RuneScape stat function.
Posted on Sep 18, 2007 7:02 pm
Posted on Sep 18, 2007 7:02 pm
This is a php snippet, first of all. As if it's that hard to tell by the title, aswell as the section of this site that the snippet resides.. second of all, I explained how to view the stats, it's meant for expansion. Not to do everything for you, it gets the skills into a readable, workable, usable array. Meaning working with and using the function is easy and simple. Next comment by me will be an example of a stat parser using my function.
PHP Snippet:
PHP RuneScape stat function.
Posted on Sep 18, 2007 7:03 pm
Posted on Sep 18, 2007 7:03 pm
// Same as what I described in the introduction to the snippet, but for the "slower" people, here it is all the way done.
function getStats($n) {
$d = file_get_contents("http://hiscore.runescape.com/lang/en/aff/runescape/hiscorepersonal.ws?user1=".$n);
preg_match_all("/<td align=\\"left\\">(.*?)<\\/tr>/s",$d,$m);
$u = array("\\n","\\r");
$g = array('/^\\s+/','/\\s{2,}/');
$o = array('',' ');
$s = array();
foreach ($m[1] as $v) {
$ta = explode(" ",preg_replace($g,$o,str_replace($u,' ',strip_tags($v))));
$line .= $ta[2];
$s[$ta[0]] = array('Rank' => $ta[1],'Level' => $ta[2],'Exp' => $ta[3]);
}
return (($s['Overall']['Level'] == "does")? "false":$s);
}
$variable = getStats($_GET['rsn']);
foreach ($variable as $skill => $v) {
$line = $skill;
foreach ($variable[$skill] as $aspect => $data) {
$line .= " ".$aspect.": ".$data;
}
echo $line."\\n";
}
function getStats($n) {
$d = file_get_contents("http://hiscore.runescape.com/lang/en/aff/runescape/hiscorepersonal.ws?user1=".$n);
preg_match_all("/<td align=\\"left\\">(.*?)<\\/tr>/s",$d,$m);
$u = array("\\n","\\r");
$g = array('/^\\s+/','/\\s{2,}/');
$o = array('',' ');
$s = array();
foreach ($m[1] as $v) {
$ta = explode(" ",preg_replace($g,$o,str_replace($u,' ',strip_tags($v))));
$line .= $ta[2];
$s[$ta[0]] = array('Rank' => $ta[1],'Level' => $ta[2],'Exp' => $ta[3]);
}
return (($s['Overall']['Level'] == "does")? "false":$s);
}
$variable = getStats($_GET['rsn']);
foreach ($variable as $skill => $v) {
$line = $skill;
foreach ($variable[$skill] as $aspect => $data) {
$line .= " ".$aspect.": ".$data;
}
echo $line."\\n";
}
PHP Snippet:
PHP RuneScape stat function.
Posted on Dec 19, 2007 5:36 am
Posted on Dec 19, 2007 5:36 am
ZZZZZZZZZ
PHP Snippet:
PHP RuneScape stat function.
Posted on Jan 11, 2008 12:03 pm
Posted on Jan 11, 2008 12:03 pm
dude this wont work for me, is there any editing i neeed to do?





