SRL Archive - Player Transfer

Stats Sig For My Script Stats Please? $5 Prize [PayPal] For Winner!


YoHoJo

2010-01-15 21:50:30

Hey, could someone make a Stats Sig for my script stats please?
http://scriptmanager.freehostia.com/scripts.php?sid=23

I want it to show time run, Ores Mined, Loads Mined, Copper Ore Mined, Tin Ore Mined, Iron Ore Mined, Mining Xp Gained.

I'd like it to have a 'runescape' theme, as in maybe make the background look like an inventory, or bank screen or something. And have a clock to represent run time, ores to represent the ores mined, and maybe the picture of a pickaxe to represent XP gained?

Of course I want this to be updated as the stats are updated :p so it needs to be dynamic.

It would be nice if you guys had somewhere to host it, since I don't have web-space :p.

If you need any more details/have any questions just ask me.

The one I like the most gets 5$ via PayPal!
(Hmm maybe since its a competition you guys should PM me your entries? Or nah that's not really that necessary?)

Thanks,
YoHoJo

code841

2010-01-16 07:23:46

Free of charge ;), credits in the script:
[php]<?PHP
//This script was largly based on IceFire908's RuneCrafting dynamic sig
//which was a combined effort from IceFire908, A G E N T and code841
$rsfont = "/runescape_small.ttf"; //Credits: A G E N T
$timef = "/utsaah.ttf";
$im = imagecreatefrompng("template.png");
$smallsize = 12; //Font size of the count text

//Grab page source using curl.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://scriptmanager.freehostia.com/scripts.php?sid=23");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$page = curl_exec($ch); //Page source to variable ($page)

//Search page source for the starting variable
preg_match('/<td>Total Time<.td>[\s]+<td(.*?)>[\s]+(.*?)<.td>/', $page, $matches);
$time = trim($matches[2]);
//Format time to simplified credits: A G E N T
$time = str_replace(array(" days", " day"), "D", $time);
$time = str_replace(array(" hours", " hour"), "H", $time);
$time = str_replace(array(" minutes", " minute"), "M", $time);
$time = str_replace(array(" weeks", " week"), "W", $time);
$time = str_replace(array(" months", " month"), "M", $time);
$time = str_replace(array(" years", " year"), "Y", $time);
$time = str_replace(array(" and ", ", "), ":", $time);

//Retrieve Values
$valueArr = array("Loads Mined","Copper Ore Mined","Tin Ore Mined","Iron Ore Mined","Ores Mined","Mining Xp Gained");
for($i=0;$i<=5;$i++) {
preg_match("/<td.*>$valueArr[$i]<.td>[\s]+<td.*?>[\s]*?(.*?)<.td>/", $page, $matches);
$item[$i] = trim($matches[1]);
}

//Format the values to mimic RS credits: A G E N T
function rsformat($value)
{
$letters = array(3=>"K", 6=>"M", 9=>"B");
if($value >= 100000)
{
$exp = floor(log($value, 10));
$num = $value/pow(10, $exp);

if(($exp % 3) != 0)
{
$num = $num * pow(10, ($exp % 3));
$exp = $exp - ($exp % 3);
}
elseif(($exp % 3) == 0)
{
$num = $num * 1000;
$exp += -3;
}
return floor($num).$letters[$exp];
}
else return $value;
}
$black = imagecolorallocate($im, 0, 0, 0); //black
$yellow = imagecolorallocate($im, 255, 255, 0); //yellow
$white = imagecolorallocate($im, 255, 255, 255); //white
$green = imagecolorallocate($im, 0, 255, 0); //green
$grey = imagecolorallocate($im, 204, 204, 204); //grey

$varX = 18;
$varY = 38;

for($i=0;$i<=3;$i++){
if($item[$i] > 99999) {
$color = $white;
} else {
$color = $yellow;
}
if($item[$i] > 9999999) {
$color = $green;
}
if($i>0){
$varX = $varX + 42;
}
imagettftext($im, $smallsize, 0, $varX+1, $varY+1, $black, $rsfont, rsformat($item[$i]));
imagettftext($im, $smallsize, 0, $varX, $varY, $color, $rsfont, rsformat($item[$i]));
}
imagettftext($im, 10, 0, 196, 51, $black, $rsfont, rsformat($item[4])); //Create Total Ores shadow
imagettftext($im, 10, 0, 195, 50, $grey, $rsfont, rsformat($item[4])); //Create Total Ores
imagettftext($im, 10, 0, 169, 93, $black, $rsfont, number_format($item[5])); //Create the Mining XP shadow
imagettftext($im, 10, 0, 168, 92, $grey, $rsfont, number_format($item[5])); //Create the Mining XP text
imagettftext($im, 14, 0, 52, 88, $black, $timef, $time); //Backdrop shadow of time
imagettftext($im, 14, 0, 51, 87, $white, $timef, $time); //Create the time text


header("Content-Type: image/png"); //Browser display header
imagepng($im); //Create image
imagedestroy($im); //Free image from memory
?> [/php]

Forgot to add the files:
http://myscriptx.com/upl/dynamic-sig.zip

Frement

2010-01-16 08:24:28

Ooh, nice i gotta have to make one too! :)

Ok, background done, now for the php script.

Current progress of the script:

YoHoJo

2010-01-16 15:14:28

Wow thanks guys.
I like code841's free of charge :p

And I like Frement's design better because its more 'runescapey' Like the font of the script name.
(I'm guessing you're not all the way done yet? Since only time running shows up and you say 'current progress'?)
Also Frement, thanks SO MUCH for using my script a lot, your helping the stats out A LOT!
I'd like it if you changed you clock to something more 'runescapey' like this please:

And how about next to the bag have
Ores Mined:
Loads Mined:
(Instead of having ores mined near the pickaxe)

Once again a HUGE thanks to both you! So far I'm liking Frement's better maybe I'll give you both some $ :D.

code841

2010-01-16 16:13:08

Aww, I'm no good with art/design. Frement's does look much neater than mine.
But if you really do need a webhost for the script I am willing to offer a free subdomain/directory with myscriptx.com (my own) again I wont ask for money (don't worry my host is extremely cheap, but reliable).

YoHoJo

2010-01-16 16:26:59

Haha you don't suck at all code841! I bet a bunch of people here don't even know the first thing about making a dynamic sig that shows stats [Like me!]! And yours is pretty good dude, just change the font a bit, and I would have liked it just as much as I like Frement's! Well, it looks like Frement has his own space to host, but thanks anyways! I still like yours a lot! Dont be sad! :D

Frement

2010-01-16 16:40:22

So you want mine? ill finish coding the php later tonight… and yes i can host it too.

And i dont need any money for this :)

YoHoJo

2010-01-16 16:42:38

Yes please Frement! It looks great. Just change your clock to runescape's 'watch' item. And instead of putting Ores Mined next to the pickaxe, just have both 'Ore Mined' and 'Loads Mined' next to the Inventory Icon please! Looks great I can't wait!

Wanted

2010-01-16 16:43:30

If you need help doing this, there is the thread about my old sig. Don't forget to make the black shadow for the item text… all you have to do is make it X + 1 Y + 1 then print the regular text on top of it

Frement

2010-01-16 16:50:00

From: IceFire908
If you need help doing this, there is the thread about my old sig. Don't forget to make the black shadow for the item text… all you have to do is make it X + 1 Y + 1 then print the regular text on top of it


Was that for me? It does have black shadow already :)

Wanted

2010-01-16 16:57:37

From: Frement
Was that for me? It does have black shadow already :)


Ah, well then just be sure to check if the numbers are printing out in the right place… they look a 1 or 2 pixels to far to the left. easy way to test is to bank like 10 stacked items, then test 10 and move it accordingly.

Frement

2010-01-16 17:02:02

From: IceFire908
Ah, well then just be sure to check if the numbers are printing out in the right place… they look a 1 or 2 pixels to far to the left. easy way to test is to bank like 10 stacked items, then test 10 and move it accordingly.


Well its x+1,y+1 so i think it should be ok.

Heres my function:
[PHP]<?php

function imagettftextshadow( $image, $size, $angle, $x, $y, $color, $fontfile, $text ) {
imagettftext( $image, $size, $angle, $x + 1, $y + 1, imagecolorallocate( $image, 0, 0, 0 ), $fontfile, $text );
imagettftext( $image, $size, $angle, $x, $y, $color, $fontfile, $text );
}

?>[/PHP]

Ok, YoHoJo, i think its done :)

YoHoJo

2010-01-16 17:19:25

Ahh! Awesome dude, I just came!
I LOVE it!
:/ Could you please make the changed I stated above later at your earliest convenience? Thanks :p!

So cool, thanks again! :D! :D!

Frement

2010-01-16 17:20:57

Ok, will do my best :P

Wanted

2010-01-16 17:23:43

From: Frement
Well its x+1,y+1 so i think it should be ok.

Heres my function:
[PHP]<?php

function imagettftextshadow( $image, $size, $angle, $x, $y, $color, $fontfile, $text ) {
imagettftext( $image, $size, $angle, $x + 1, $y + 1, imagecolorallocate( $image, 0, 0, 0 ), $fontfile, $text );
imagettftext( $image, $size, $angle, $x, $y, $color, $fontfile, $text );
}

?>[/PHP]

Ok, YoHoJo, i think its done :)


actually, I was talking about the overall letter placement was to far to the left.

Frement

2010-01-16 17:24:46

From: IceFire908
actually, I was talking about the overall letter placement was to far to the left.


Yes i know, i made it so that there would fit 9999999 number. As it doesnt overlap the right end of the image.

Wanted

2010-01-16 17:27:23

From: Frement
Yes i know, i made it so that there would fit 9999999 number. As it doesnt overlap the right end of the image.


why not just use the the K, M system?

YoHoJo

2010-01-16 17:28:38

From: IceFire908
why not just use the the K, M system?


Good Point! :D

Frement

2010-01-16 17:34:36

Yeah lol :D Well, im retarded!

Latest fixed: