Jump to content

[SOLVED] RuneScape Stat Signature Maker


LemonInflux

Recommended Posts

Hello, I'm Tom. My friend is making a runescape helpsite, and asked me to help with the database and PHP coding. I have been able to make the databases, calculators and stat lookups easily enough. But the thing I can't do is create a signature maker. This is the code for the stat lookup:

 

<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body,td,th {
color: #FFFFFF;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
body {
background-color: #666666;
}
.style1 {color: #666666}
-->
</style>
<?PHP $username = $_POST['username']; ?></head>
<title>Stats for <?PHP echo $username; ?></title>
<body>
<?PHP

$website = file_get_contents('http://hiscore.runescape.com/index_lite.ws?player='.$username);

$stats = explode("\n", $website);
$overall = explode(",", $stats[0]);
$att = explode(",", $stats[1]);
$def = explode(",", $stats[2]);
$str = explode(",", $stats[3]);
$hp = explode(",", $stats[4]);
$rng = explode(",", $stats[5]);
$pry = explode(",", $stats[6]);
$mag = explode(",", $stats[7]);
$ck = explode(",", $stats[8]);
$wc = explode(",", $stats[9]);
$flt = explode(",", $stats[10]);
$fsh = explode(",", $stats[11]);
$fm = explode(",", $stats[12]);
$cra = explode(",", $stats[13]);
$smi = explode(",", $stats[14]);
$min = explode(",", $stats[15]);
$her = explode(",", $stats[16]);
$ag = explode(",", $stats[17]);
$th = explode(",", $stats[18]);
$sl = explode(",", $stats[19]);
$frm = explode(",", $stats[20]);
$rc = explode(",", $stats[21]);
$hun = explode(",", $stats[22]);
$cs = explode(",", $stats[23]);

if ($att[1] == 1) {
$att[1] = " ";
}  if ($str[1] == 1) {
$str[1] = " ";
}  if ($def[1] == 1) {
$def[1] = " ";
}  if ($hp[1] == 1) {
$hp[1] = " ";
}  if ($rng[1] == 1) {
$rng[1] = " ";
}  if ($pry[1] == 1) {
$pry[1] = " ";
}  if ($mag[1] == 1) {
$mag[1] = " ";
} if ($ck[1] == 1) {
$ck[1] = " ";
} if ($wc[1] == 1) {
$wc[1] = " ";
} if ($flt[1] == 1) {
$flt[1] = " ";
} if ($fsh[1] == 1) {
$fsh[1] = " ";
} if ($fm[1] == 1) {
$fm[1] = " ";
} if ($cra[1] == 1) {
$cra[1] = " ";
} if ($smi[1] == 1) {
$smi[1] = " ";
} if ($min[1] == 1) {
$min[1] = " ";
} if ($her[1] == 1) {
$her[1] = " ";
} if ($ag[1] == 1) {
$ag[1] = " ";
} if ($th[1] == 1) {
$th[1] = " ";
} if ($sl[1] == 1) {
$sl[1] = " ";
} if ($frm[1] == 1) {
$frm[1] = " ";
} if ($rc[1] == 1) {
$rc[1] = " ";
} if ($hun[1] == 1) {
$hun[1] = " ";
} if ($cs[1] == 1) {
$cs[1] = " ";
} 
?>
<h1 align="center">Stats for <?PHP echo $username; ?></h1>
<p align="center"> </p>
<div align="center">
  <table border="0" cellpadding="0" cellspacing="0" width="190">
    <!-- fwtable fwsrc="original.png" fwbase="export.gif" fwstyle="Dreamweaver" fwdocid = "227682448" fwnested="0" -->
    <tr>
      <td><img src="Images/spacer.gif" width="23" height="1" border="0" alt=""></td>
      <td><img src="Images/spacer.gif" width="38" height="1" border="0" alt=""></td>
      <td><img src="Images/spacer.gif" width="27" height="1" border="0" alt=""></td>
      <td><img src="Images/spacer.gif" width="38" height="1" border="0" alt=""></td>
      <td><img src="Images/spacer.gif" width="26" height="1" border="0" alt=""></td>
      <td><img src="Images/spacer.gif" width="38" height="1" border="0" alt=""></td>
      <td><img src="Images/spacer.gif" width="1" height="1" border="0" alt=""></td>
    </tr>
    <tr>
      <td rowspan="16"><img name="export_r1_c1" src="Images/export_r1_c1.gif" width="23" height="193" border="0" alt=""></td>
      <td valign="top" bgcolor="#666666"><p align="center">        <?PHP echo $att[1] ?>        </p></td>
      <td rowspan="16"><img name="export_r1_c3" src="Images/export_r1_c3.gif" width="27" height="193" border="0" alt=""></td>
      <td valign="top" bgcolor="#666666"><p align="center"><?PHP echo $hp[1] ?></p></td>
      <td rowspan="16"><img name="export_r1_c5" src="Images/export_r1_c5.gif" width="26" height="193" border="0" alt=""></td>
      <td valign="top" bgcolor="#666666"><p align="center"><?PHP echo $min[1] ?></p></td>
      <td><img src="Images/spacer.gif" width="1" height="21" border="0" alt=""></td>
    </tr>
    <tr>
      <td><div align="center"><img name="export_r2_c2" src="Images/export_r2_c2.gif" width="38" height="2" border="0" alt=""></div></td>
      <td><div align="center"><img name="export_r2_c4" src="Images/export_r2_c4.gif" width="38" height="2" border="0" alt=""></div></td>
      <td><div align="center"><img name="export_r2_c6" src="Images/export_r2_c6.gif" width="38" height="2" border="0" alt=""></div></td>
      <td><img src="Images/spacer.gif" width="1" height="2" border="0" alt=""></td>
    </tr>
    <tr>
      <td valign="top" bgcolor="#666666"><p align="center"><?PHP echo $str[1] ?></p></td>
      <td valign="top" bgcolor="#666666"><p align="center"><?PHP echo $ag[1] ?></p></td>
      <td valign="top" bgcolor="#666666"><p align="center"><?PHP echo $smi[1] ?></p></td>
      <td><img src="Images/spacer.gif" width="1" height="22" border="0" alt=""></td>
    </tr>
    <tr>
      <td><div align="center"><img name="export_r4_c2" src="Images/export_r4_c2.gif" width="38" height="2" border="0" alt=""></div></td>
      <td><div align="center"><img name="export_r4_c4" src="Images/export_r4_c4.gif" width="38" height="2" border="0" alt=""></div></td>
      <td><div align="center"><img name="export_r4_c6" src="Images/export_r4_c6.gif" width="38" height="2" border="0" alt=""></div></td>
      <td><img src="Images/spacer.gif" width="1" height="2" border="0" alt=""></td>
    </tr>
    <tr>
      <td valign="top" bgcolor="#666666"><p align="center"><?PHP echo $def[1] ?></p></td>
      <td valign="top" bgcolor="#666666"><p align="center"><?PHP echo $her[1] ?></p></td>
      <td valign="top" bgcolor="#666666"><p align="center"><?PHP echo $fsh[1] ?></p></td>
      <td><img src="Images/spacer.gif" width="1" height="22" border="0" alt=""></td>
    </tr>
    <tr>
      <td><div align="center"><img name="export_r6_c2" src="Images/export_r6_c2.gif" width="38" height="2" border="0" alt=""></div></td>
      <td><div align="center"><img name="export_r6_c4" src="Images/export_r6_c4.gif" width="38" height="2" border="0" alt=""></div></td>
      <td><div align="center"><img name="export_r6_c6" src="Images/export_r6_c6.gif" width="38" height="2" border="0" alt=""></div></td>
      <td><img src="Images/spacer.gif" width="1" height="2" border="0" alt=""></td>
    </tr>
    <tr>
      <td valign="top" bgcolor="#666666"><p align="center"><?PHP echo $rng[1] ?></p></td>
      <td valign="top" bgcolor="#666666"><p align="center"><?PHP echo $th[1] ?></p></td>
      <td valign="top" bgcolor="#666666"><p align="center"><?PHP echo $ck[1] ?></p></td>
      <td><img src="Images/spacer.gif" width="1" height="22" border="0" alt=""></td>
    </tr>
    <tr>
      <td><div align="center"><img name="export_r8_c2" src="Images/export_r8_c2.gif" width="38" height="3" border="0" alt=""></div></td>
      <td><div align="center"><img name="export_r8_c4" src="Images/export_r8_c4.gif" width="38" height="3" border="0" alt=""></div></td>
      <td><div align="center"><img name="export_r8_c6" src="Images/export_r8_c6.gif" width="38" height="3" border="0" alt=""></div></td>
      <td><img src="Images/spacer.gif" width="1" height="3" border="0" alt=""></td>
    </tr>
    <tr>
      <td valign="top" bgcolor="#666666"><p align="center"><?PHP echo $pry[1] ?></p></td>
      <td valign="top" bgcolor="#666666"><p align="center"><?PHP echo $cra[1] ?></p></td>
      <td valign="top" bgcolor="#666666"><p align="center"><?PHP echo $fm[1] ?></p></td>
      <td><img src="Images/spacer.gif" width="1" height="22" border="0" alt=""></td>
    </tr>
    <tr>
      <td><div align="center"><img name="export_r10_c2" src="Images/export_r10_c2.gif" width="38" height="2" border="0" alt=""></div></td>
      <td><div align="center"><img name="export_r10_c4" src="Images/export_r10_c4.gif" width="38" height="2" border="0" alt=""></div></td>
      <td><div align="center"><img name="export_r10_c6" src="Images/export_r10_c6.gif" width="38" height="2" border="0" alt=""></div></td>
      <td><img src="Images/spacer.gif" width="1" height="2" border="0" alt=""></td>
    </tr>
    <tr>
      <td valign="top" bgcolor="#666666"><p align="center"><?PHP echo $mag[1] ?></p></td>
      <td valign="top" bgcolor="#666666"><p align="center"><?PHP echo $flt[1] ?></p></td>
      <td valign="top" bgcolor="#666666"><p align="center"><?PHP echo $wc[1] ?></p></td>
      <td><img src="Images/spacer.gif" width="1" height="22" border="0" alt=""></td>
    </tr>
    <tr>
      <td><div align="center"><img name="export_r12_c2" src="Images/export_r12_c2.gif" width="38" height="2" border="0" alt=""></div></td>
      <td><div align="center"><img name="export_r12_c4" src="Images/export_r12_c4.gif" width="38" height="2" border="0" alt=""></div></td>
      <td><div align="center"><img name="export_r12_c6" src="Images/export_r12_c6.gif" width="38" height="2" border="0" alt=""></div></td>
      <td><img src="Images/spacer.gif" width="1" height="2" border="0" alt=""></td>
    </tr>
    <tr>
      <td valign="top" bgcolor="#666666"><p align="center"><?PHP echo $rc[1] ?></p></td>
      <td valign="top" bgcolor="#666666"><p align="center"><?PHP echo $sl[1] ?></p></td>
      <td valign="top" bgcolor="#666666"><p align="center"><?PHP echo $frm[1] ?></p></td>
      <td><img src="Images/spacer.gif" width="1" height="22" border="0" alt=""></td>
    </tr>
    <tr>
      <td><div align="center"><img name="export_r14_c2" src="Images/export_r14_c2.gif" width="38" height="2" border="0" alt=""></div></td>
      <td><div align="center"><img name="export_r14_c4" src="Images/export_r14_c4.gif" width="38" height="2" border="0" alt=""></div></td>
      <td><div align="center"><img name="export_r14_c6" src="Images/export_r14_c6.gif" width="38" height="2" border="0" alt=""></div></td>
      <td><img src="Images/spacer.gif" width="1" height="2" border="0" alt=""></td>
    </tr>
    <tr>
      <td valign="top" bgcolor="#666666"><p align="center"><?PHP echo $cs[1] ?></p></td>
      <td valign="top" bgcolor="#666666"><p align="center"><?PHP echo $hun[1] ?></p></td>
      <td valign="top" bgcolor="#666666"><p align="center"><?PHP echo $overall[1] ?></p></td>
      <td><img src="Images/spacer.gif" width="1" height="22" border="0" alt=""></td>
    </tr>
    <tr>
      <td><img name="export_r16_c2" src="Images/export_r16_c2.gif" width="38" height="3" border="0" alt=""></td>
      <td><img name="export_r16_c4" src="Images/export_r16_c4.gif" width="38" height="3" border="0" alt=""></td>
      <td><img name="export_r16_c6" src="Images/export_r16_c6.gif" width="38" height="3" border="0" alt=""></td>
      <td><img src="Images/spacer.gif" width="1" height="3" border="0" alt=""></td>
    </tr>
  </table>
  <p>

 

Now, I want to list the variables shown here (skills) onto a picture (namely, this picture):

demo.png

 

This is the basic layout (it won't look like that in the end). I want to know how to write the stats that show up in the process page onto the signature in an output page, and possibly if there's a way to auto-save it to my server as well, so it continuously updates. To see a so far working example (basically, just the stat lookup), it can be found here. If you know a solution, but don't have a runescape account, just enter 'zezima'

Link to comment
https://forums.phpfreaks.com/topic/66898-solved-runescape-stat-signature-maker/
Share on other sites

  • Replies 79
  • Created
  • Last Reply

what you could do is create an image from the symbols with a bit extra on the right and then just write the text to the image. Then combine all the pictues and have a sig.

 

<?php

$stat = 10;
$colour = imagecolorallocate($image, 0, 0, 0);
$image_link = your_image.gif
$image = imagecreatefromgif($image_link);

imagestring($image, x, y, z, $stat, $colour);

?>

 

x= font size between 0-5 (5 being biggest)

y = x-coordinate of the upper left corner

z = y-coordinate of the upper left corner

 

Then you would have to put the images together, not sure how you would do it, but that is the basic-ness of doing it

 

~ Chocopi

Thats what I was trying to say but I couldn't word it :P

 

So you just need to do it all at one point and it will be all good ;D

 

BTW: The ranging and wood cutting stats are not appearing

 

~ Chocopi

And about the stats, they work fine for me. hm.

Basically you will just need to write the stats. So for example, if you use the image you gave in the first post just find the co-ordinates of where you want the text to be written

 

<?php

$image_link = blah/image.gif // the link address for the image that you gave in first post
$image = imagecreatefromgif($image_link);

$font_colour = imagecolorallocate($image, 0, 0, 0);
$font_size = 5; // between 0-5

$x = 5; // your x co-ordinate
$y = 5; // your y co-ordinate

$stat = 10; // the attack stat for example

imagestring($image, $font_size, $x, $y, $stat, $font_colour);

?>

 

~ Chocopi

Also, that didn't work. http://www.boddingtonparish.co.uk/php/output.php

 

Code is

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php

$image_link = blah/image.gif // the link address for the image that you gave in first post
$image = imagecreatefromgif($image_link);

$font_colour = imagecolorallocate($image, 0, 0, 0);
$font_size = 5; // between 0-5

$x = 31; // your x co-ordinate
$y = 8; // your y co-ordinate

$stat = 10; // the attack stat for example

imagestring($image, $font_size, $x, $y, $stat, $font_colour);

?>
</body>
</html>

 

Please tell me how to fix this, have to go. Back later.

You will need to replace the blah/image.gif with whatever the link address is for your overall image, like the one you used in the first post

 

Also, we need to display the image

 

header("Content-type: image/gif");
imagegif($image);

 

~ Chocopi

<?PHP $username = $_POST['username']; ?>
<?PHP

$website = file_get_contents('http://hiscore.runescape.com/index_lite.ws?player='.$username);

$stats = explode("\n", $website);
$overall = explode(",", $stats[0]);
$att = explode(",", $stats[1]);
$def = explode(",", $stats[2]);
$str = explode(",", $stats[3]);
$hp = explode(",", $stats[4]);
$rng = explode(",", $stats[5]);
$pry = explode(",", $stats[6]);
$mag = explode(",", $stats[7]);
$ck = explode(",", $stats[8]);
$wc = explode(",", $stats[9]);
$flt = explode(",", $stats[10]);
$fsh = explode(",", $stats[11]);
$fm = explode(",", $stats[12]);
$cra = explode(",", $stats[13]);
$smi = explode(",", $stats[14]);
$min = explode(",", $stats[15]);
$her = explode(",", $stats[16]);
$ag = explode(",", $stats[17]);
$th = explode(",", $stats[18]);
$sl = explode(",", $stats[19]);
$frm = explode(",", $stats[20]);
$rc = explode(",", $stats[21]);
$hun = explode(",", $stats[22]);
$cs = explode(",", $stats[23]);

if ($att[1] == 1) {
$att[1] = " ";
}  if ($str[1] == 1) {
$str[1] = " ";
}  if ($def[1] == 1) {
$def[1] = " ";
}  if ($hp[1] == 1) {
$hp[1] = " ";
}  if ($rng[1] == 1) {
$rng[1] = " ";
}  if ($pry[1] == 1) {
$pry[1] = " ";
}  if ($mag[1] == 1) {
$mag[1] = " ";
} if ($ck[1] == 1) {
$ck[1] = " ";
} if ($wc[1] == 1) {
$wc[1] = " ";
} if ($flt[1] == 1) {
$flt[1] = " ";
} if ($fsh[1] == 1) {
$fsh[1] = " ";
} if ($fm[1] == 1) {
$fm[1] = " ";
} if ($cra[1] == 1) {
$cra[1] = " ";
} if ($smi[1] == 1) {
$smi[1] = " ";
} if ($min[1] == 1) {
$min[1] = " ";
} if ($her[1] == 1) {
$her[1] = " ";
} if ($ag[1] == 1) {
$ag[1] = " ";
} if ($th[1] == 1) {
$th[1] = " ";
} if ($sl[1] == 1) {
$sl[1] = " ";
} if ($frm[1] == 1) {
$frm[1] = " ";
} if ($rc[1] == 1) {
$rc[1] = " ";
} if ($hun[1] == 1) {
$hun[1] = " ";
} if ($cs[1] == 1) {
$cs[1] = " ";
} 
?>
<?php

header("Content-type: image/png");

$image_link = demo.png 
$image = imagecreatefrompng($image_link);

$font_colour = imagecolorallocate($image, 0, 0, 0);
$font_size = 5; 

$x = 31; 
$y = 8; 

$stat = att[1];

imagestring($image, $font_size, $x, $y, $stat, $font_colour);

?>

try this:

<?php
$username = $_POST['username'];

$website = file_get_contents('http://hiscore.runescape.com/index_lite.ws?player=' . $username);

$stats = explode("\n", $website);
$overall = explode(",", $stats[0]);
$att = explode(",", $stats[1]);
$def = explode(",", $stats[2]);
$str = explode(",", $stats[3]);
$hp = explode(",", $stats[4]);
$rng = explode(",", $stats[5]);
$pry = explode(",", $stats[6]);
$mag = explode(",", $stats[7]);
$ck = explode(",", $stats[8]);
$wc = explode(",", $stats[9]);
$flt = explode(",", $stats[10]);
$fsh = explode(",", $stats[11]);
$fm = explode(",", $stats[12]);
$cra = explode(",", $stats[13]);
$smi = explode(",", $stats[14]);
$min = explode(",", $stats[15]);
$her = explode(",", $stats[16]);
$ag = explode(",", $stats[17]);
$th = explode(",", $stats[18]);
$sl = explode(",", $stats[19]);
$frm = explode(",", $stats[20]);
$rc = explode(",", $stats[21]);
$hun = explode(",", $stats[22]);
$cs = explode(",", $stats[23]);

if ($att[1] == 1) {
$att[1] = " ";
}  if ($str[1] == 1) {
$str[1] = " ";
}  if ($def[1] == 1) {
$def[1] = " ";
}  if ($hp[1] == 1) {
$hp[1] = " ";
}  if ($rng[1] == 1) {
$rng[1] = " ";
}  if ($pry[1] == 1) {
$pry[1] = " ";
}  if ($mag[1] == 1) {
$mag[1] = " ";
} if ($ck[1] == 1) {
$ck[1] = " ";
} if ($wc[1] == 1) {
$wc[1] = " ";
} if ($flt[1] == 1) {
$flt[1] = " ";
} if ($fsh[1] == 1) {
$fsh[1] = " ";
} if ($fm[1] == 1) {
$fm[1] = " ";
} if ($cra[1] == 1) {
$cra[1] = " ";
} if ($smi[1] == 1) {
$smi[1] = " ";
} if ($min[1] == 1) {
$min[1] = " ";
} if ($her[1] == 1) {
$her[1] = " ";
} if ($ag[1] == 1) {
$ag[1] = " ";
} if ($th[1] == 1) {
$th[1] = " ";
} if ($sl[1] == 1) {
$sl[1] = " ";
} if ($frm[1] == 1) {
$frm[1] = " ";
} if ($rc[1] == 1) {
$rc[1] = " ";
} if ($hun[1] == 1) {
$hun[1] = " ";
} if ($cs[1] == 1) {
$cs[1] = " ";
} 

$image_link = 'demo.png';
$image = imagecreatefrompng($image_link);

$font_colour = imagecolorallocate($image, 0, 0, 0);
$font_size = 5; 

$x = 31; 
$y = 8; 

$stat = att[1];

imagestring($image, $font_size, $x, $y, $stat, $font_colour);

header('Content-type: image/png');
imagejpeg($image);
imagedestroy($image);
?>

 

I think the problem was you weren't outputting the image with

imagejpeg($image);

 

also make sure that the demo.png is in the same directory as this file

okay.. I've been quite bored so I've actually done this.

<?php
$username = $_POST['username'];
$username = strtolower(str_replace(' ', '_', $username));

$website = file_get_contents('http://hiscore.runescape.com/index_lite.ws?player=' . $username);

$stats = explode("\n", $website);
$overall = array_shift(explode(",", $stats[0]));
$stat['att'] = array_shift(explode(",", $stats[1]));
$stat['def'] = array_shift(explode(",", $stats[2]));
$stat['str'] = array_shift(explode(",", $stats[3]));
$stat['hp'] = array_shift(explode(",", $stats[4]));
$stat['rng'] = array_shift(explode(",", $stats[5]));
$stat['pry'] = array_shift(explode(",", $stats[6]));
$stat['mag'] = array_shift(explode(",", $stats[7]));
$stat['ck'] = array_shift(explode(",", $stats[8]));
$stat['wc'] = array_shift(explode(",", $stats[9]));
$stat['flt'] = array_shift(explode(",", $stats[10]));
$stat['fsh'] = array_shift(explode(",", $stats[11]));
$stat['fm'] = array_shift(explode(",", $stats[12]));
$stat['cra'] = array_shift(explode(",", $stats[13]));
$stat['smi'] = array_shift(explode(",", $stats[14]));
$stat['min'] = array_shift(explode(",", $stats[15]));
$stat['her'] = array_shift(explode(",", $stats[16]));
$stat['ag'] = array_shift(explode(",", $stats[17]));
$stat['th'] = array_shift(explode(",", $stats[18]));
$stat['sl'] = array_shift(explode(",", $stats[19]));
$stat['frm'] = array_shift(explode(",", $stats[20]));
$stat['rc'] = array_shift(explode(",", $stats[21]));
$stat['hun'] = array_shift(explode(",", $stats[22]));
$stat['cs'] = array_shift(explode(",", $stats[23]));


$image_link = 'demo.png';
$image = imagecreatefrompng($image_link);

$font_colour = imagecolorallocate($image, 0, 0, 0);
$font_size = 5; 

$x = array('28', '80', '135', '188', '240'); 
$y = array('8', '29', '52', '77', '100'); 

$i = '0';
$a = '0';
foreach($stat as $s_key => $value){
imagestring($image, $font_size, $x[$a], $y[$i], $value, $font_colour);
$i++;
if($i == '5'){
	$i = '0';
	$a++;
}
}

imagestring($image, $font_size, '240', '82', 'overall: ' . $overall, $font_colour);

header('Content-type: image/png');
imagejpeg($image);
imagedestroy($image);
?>

 

The code above works perfectly. It even writes out the total.

It's also a lot shorter than your code.

 

please note that your code only works for users in the top so many users.

My character doesn't show up...

 

 

EDIT: just realised you also need to replace spaces with underscores. I've added the change in the code, and made the username lowercase.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.