• Log in or sign up for an account here: https://www.sythe.org/login

Can Someone Help Me On This [php] Question

RsPlayer509

Forum Addict
Joined
Feb 1, 2009
Sythe Gold
0
Messages
610
Can ANyone Link Me To A Tutorial That Shows You How Too Make A Dynamic Runescape Sig?
 
Dynamic RuneScape signature? I'm guessing you mean something that will display your stats, sort of like this:

image.png


or

image.png


I cannot link you to a tutorial because I don't really know where to find one, but these scripts are very simple to make. Basically, you use the RuneScape hiscores page, http://hiscore.runescape.com/index_lite.ws?player=Zezima , parse the page to get the values of the separate skills, and use PHP's GD Image library to create an image with the values. This is the code I used for the highscore one:
Code:
<?php
/******************************
* [script] Dynamic RuneScape Highscore Script
* [author] Stephen "AADude" Brotman
*
* [arguments]
** [player] Player name to grab level information from
******************************/

function drshs_cb($attack, $defence, $strength, $hitpoints, $prayer, $range, $magic, $summoning)
{
	$base = ($defence + $hitpoints + floor($prayer / 2) + floor($summoning / 2)) * 0.25;

	$melee = ($attack + $strength) * 0.325;
	$ranger = floor($range * 1.5) * 0.325;
	$mage = floor($magic * 1.5) * 0.325;

	return $base + max($melee, $ranger, $mage);
}


$_lgss["skills"] = array("overall", "attack", "defence", "strength", "hitpoints", "range", "prayer", "magic", "cooking", "woodcutting", "fletching", "fishing", "firemaking", "crafting", "smithing", "mining", "herblore", "agility", "thieving", "slayer", "farming", "runecraft", "hunter", "construction", "summoning");

$_lgss["cmd"] = explode("/", $_SERVER["PATH_INFO"]);
$_lgss["player"] = get_magic_quotes_gpc() ? $_lgss["cmd"][1] : addslashes($_lgss["cmd"][1]);

$_lgss["source"]["array"] = explode("\n", str_replace("-1", "1", file_get_contents("http://hiscore.runescape.com/index_lite.ws?player=" . $_lgss["player"])));

$_lgss["image"]["handle"] = imagecreate(235, 520);
$_lgss["image"]["bgcol"] = imagecolorallocate($_lgss["image"]["handle"], 255, 105, 180);
$_lgss["image"]["textcol"] = imagecolorallocate($_lgss["image"]["handle"], 0, 0, 0);
$y = 20;
for ($i = 0; $i <= 24; $i++)
{
	$_lgss["levels"][$i] = explode(",", $_lgss["source"]["array"][$i]);
	$_lgss["image"]["skill"] = imagecreatefromgif("http://www.runescape.com/img/hiscores/skill_icon_" . $_lgss["skills"][$i] . "1.gif");
imagecopy($_lgss["image"]["handle"], $_lgss["image"]["skill"], 0, $y, 0, 0, imagesx($_lgss["image"]["skill"]), imagesy($_lgss["image"]["skill"]));
	imagestring($_lgss["image"]["handle"], 2, 20, $y, "[level] " . number_format(intval($_lgss["levels"][$i][1])) . "; [xp] " . number_format(intval($_lgss["levels"][$i][2])), $_lgss["image"]["textcol"]);
	$y += 20;
}

$_lgss["combat"] = drshs_cb(intval($_lgss["levels"][1][1]), intval($_lgss["levels"][2][1]), intval($_lgss["levels"][3][1]), intval($_lgss["levels"][4][1]), intval($_lgss["levels"][6][1]), intval($_lgss["levels"][5][1]), intval($_lgss["levels"][7][1]), intval($_lgss["levels"][24][1]));

imagecolortransparent($_lgss["image"]["handle"], $_lgss["image"]["bgcol"]);
imagestring($_lgss["image"]["handle"], 2, 20, 0, "[name] " . $_lgss["player"] . "; [combat] " . $_lgss["combat"], $_lgss["image"]["textcol"]);

header("Content-Type: image/png");
imagepng($_lgss["image"]["handle"]);
imagedestroy($_lgss["image"]["handle"]);
?>

And this is for the goal script:

Code:
<?php
/******************************
* [script] Basic Stat Goal Signature Script
* [author] Stephen "AADude" Brotman
*
* [arguments]
** [player] Player name to grab level information from
** [skill] Skill to use as current level
*** [0] Overall
*** [1] Attack
*** [2] Defense
*** [3] Strength
*** [4] Hitpoints
*** [5] Range
*** [6] Prayer
*** [7] Magic
*** [8] Cooking
*** [9] Woodcutting
*** [10] Fletching
*** [11] Fishing
*** [12] Firemaking
*** [13] Crafting
*** [14] Smithing
*** [15] Mining
*** [16] Herblore
*** [17] Agility
*** [18] Thieving
*** [19] Slayer
*** [20] Farming
*** [21] Runecraft
*** [22] Hunter
*** [23] Construction
*** [24] Summoning
** [goal] Goal level for that skill

******************************/

$_lgss["skills"] = array("overall", "attack", "defence", "strength", "hitpoints", "range", "prayer", "magic", "cooking", "woodcutting", "fletching", "fishing", "firemaking", "crafting", "smithing", "mining", "herblore", "agility", "thieving", "slayer", "farming", "runecraft", "hunter", "construction", "summoning");
$_lgss["xps"] = array(1 => 0, 83, 174, 276, 388, 512, 650, 801, 969, 1154, 1358, 1584, 1833, 2107, 2411, 2746, 3115, 3523, 3973, 4470, 5018, 5624, 6291, 7028, 7842, 8740, 9730, 10824, 12031, 13363, 14833, 16456, 18247, 20224, 22406, 24815, 27473, 30408, 33648, 37224, 41171, 45529, 50339, 55649, 61512, 67983, 75127, 83014, 91721, 101333, 111945, 123660, 136594, 150872, 166636, 184040, 203254, 224466, 247886, 273742, 302288, 333804, 368599, 407015, 449428, 496254, 547953, 605032, 668051, 737627, 814445, 899247, 992895, 1097278, 1210421, 1336443, 1475581, 1629200, 1798808, 1986068, 2192818, 2421087, 2673114, 2951373, 3258594, 3597792, 3972294, 4385776, 4842295, 5346332, 5902831, 6517253, 7195629, 7944614, 8771558, 9684577, 10692629, 11805606, 13034431);

$_lgss["cmd"] = explode("/", $_SERVER["PATH_INFO"]);
$_lgss["player"] = get_magic_quotes_gpc() ? $_lgss["cmd"][1] : addslashes($_lgss["cmd"][1]); 
$_lgss["skill"] = intval($_lgss["cmd"][2]);
$_lgss["goal"] = intval($_lgss["cmd"][3]);

if ($_lgss["skill"] < 0 || $_lgss["skill"] > 24)
{
	$_lgss["skill"] = rand(0, 24);
}

if (($_lgss["goal"] > 99 || $_lgss["goal"] < 0) && $_lgss["skill"] > 0)
{
	$_lgss["goal"] = rand(1, 99);
}
else if (($_lgss["goal"] > 2376 || $_lgss["goal"] < 33) && $_lgss["skill"] == 0)
{
	$_lgss["goal"] = rand(33, 2376);
}

$_lgss["source"]["array"] = explode("\n", file_get_contents("http://hiscore.runescape.com/index_lite.ws?player=" . $_lgss["player"]));
$_lgss["source"]["level"] = explode(",", $_lgss["source"]["array"][$_lgss["skill"]]);

if ($_lgss["skill"] == 0)
{
	if (intval($_lgss["source"]["level"][1]) < 33)
	{
		$_lgss["source"]["level"][1] = 33;
	}
	$_lgss["percent"] = round(100*(intval($_lgss["source"]["level"][1])/$_lgss["goal"]), 2);
}
else
{
	if (intval($_lgss["source"]["level"][1]) < 1)
	{
		$_lgss["source"]["level"][1] = 1;
		$_lgss["source"]["level"][2] = 0;
	}
	$_lgss["percent"] = round(100*(intval($_lgss["source"]["level"][2])/$_lgss["xps"][$_lgss["goal"]]), 2);
}

$_lgss["percentx"] = $_lgss["percent"]*2;
if ($_lgss["percentx"] > 200)
{
	$_lgss["percentx"] = 200;
}

$_lgss["image"]["handle"] = imagecreate(225, 46);
$_lgss["image"]["skill"] = imagecreatefromgif("http://www.runescape.com/img/hiscores/skill_icon_" . $_lgss["skills"][$_lgss["skill"]] . "1.gif");
$_lgss["image"]["bgcol"] = imagecolorallocate($_lgss["image"]["handle"], 255, 105, 180);
imagecopy($_lgss["image"]["handle"], $_lgss["image"]["skill"], 0, 15, 0, 0, imagesx($_lgss["image"]["skill"]), imagesy($_lgss["image"]["skill"]));
imagecolortransparent($_lgss["image"]["handle"], $_lgss["image"]["bgcol"]);
$_lgss["image"]["textcol"] = imagecolorallocate($_lgss["image"]["handle"], 0, 0, 0);
imagestring($_lgss["image"]["handle"], 2, 20, 0, "[name] " . $_lgss["player"], $_lgss["image"]["textcol"]);
imagerectangle($_lgss["image"]["handle"], 20, 15, 220, 29, $_lgss["image"]["textcol"]);
imagefilledrectangle($_lgss["image"]["handle"], 20, 15, $_lgss["percentx"]+20, 29, $_lgss["image"]["textcol"]);
imagestring($_lgss["image"]["handle"], 2, 20, 32, "[" . $_lgss["skills"][$_lgss["skill"]] . "] " . strval($_lgss["source"]["level"][1]) . " out of " . strval($_lgss["goal"]) . ": " . strval($_lgss["percent"]) . "%", $_lgss["image"]["textcol"]);

header("Content-Type: image/png");
imagepng($_lgss["image"]["handle"]);
imagedestroy($_lgss["image"]["handle"]);
?>

(you may have seen the goal script on zybez for a few days.)
These scripts will help you get the gist of things, and if you are questioning why I used certain commands or how they are supposed to be used, you can go to http://php.net , http://phpfreaks.com/ , or you can PM me (though I may not be on Sythe very often.)
 
Runescape Gamblingrunescape gambling
Back
Top