Welcome to Gaia! ::

My Design :: Web and Graphic Design [HTML CSS PHP]

Back to Guilds

XHTML, CSS, jQuery, Javascript, PHP, mySQL, MORE! 

Tags: design, graphics, html, jquery, javascript 

Reply Server Side Programming
Make your own interactive pet!

Quick Reply

Enter both words below, separated by a space:

Can't read the text? Click here

Submit

Rydian Morrison

PostPosted: Sun Jul 16, 2006 1:23 am


Okay, so the way they interact with you sucks, and the data's stored in flat files, not a database, and you need to make your own script to lower their attributes as they get ignored, but whatever, it's something! These all go in the same directory. I do not have the time or resources (especially the hosting) to continue these pets, take them!

This holds stat1.
stat1.txt
75


This holds stat2.
stat2.txt
25


This is what makes the pet's stats change and confirms it was done.
parser.php
Fatbaby interaction$cry = $_POST['cry'];
$icecream = $_POST['icecream'];
$play = $_POST['play'];
$eaten = $_POST['eaten'];
$question = $_POST['question'];
$tv = $_POST['tv'];
$fp = fopen("fatness.txt", "r");
$fatness = fread($fp, filesize("fatness.txt")+1);
fclose($fp);
$fatness = $fatness+$cry+$icecream+$play+$eaten+$question+$tv;
if($fatness>100)
{$fatness = 100;}
if($fatness<0)
{$fatness = 0;}
$fp = fopen("fatness.txt", "w");
fwrite($fp, $fatness);
fclose($fp);
?>


Thank you for helping make my pet as healthy and happy as possible. ^^





This is the main page the users see.
index.html
Interacting with my Fatbaby






- You're sitting at home and your fatbaby starts crying. You:

Put it to sleep.

Play with it.

Give it a binky.

Let it eat your left arm. You don't use it, anyway.


- You're ordering ice cream. You get your fatbaby a:

Ultra-Super-Mega-LowFat Custard Cone

Lite Vanilla

Mint Chocolate Chip

Frozen Lard


- If forced to exercise with your fatbaby, you would:

Chip.Dip.Mouth.Repeat.

Two minutes on the Treadmill.

Sprint around the block for three hours.

Bowl.


- What's the greatest amount of food your fatbaby has ever eaten at one sitting?

A plate-ful.

Three corn kernels.

50 pounds worth.

The equivilant of a juvenile elephant.


- Which came first, the chicken or the egg?

Chicken

Egg

Fish

Who cares? They all taste the same.


- Favorite TV Channel?

Food Network

Cartoon Network

ESPN

TV LAND!!





Pets made, edited, scripted, owned, and all that pretty jazz by Rydian Morrison.
Questions made by The Masta Writa.



This is the image, it needs a background image that has the pet on it to be 400x225 pixels. Also, the text here is light green because the original image I used was black.
image2.php
$fp = fopen("stat1.txt", "r");
$stat1 = fread($fp, filesize("stat1.txt")+1);
fclose($fp);

$fp = fopen("stat2.txt", "r");
$stat2 = fread($fp, filesize("stat2.txt")+1);
fclose($fp);

$mainimage = imagecreatefromjpeg("mouse_brown1.jpg");

$name = " Name: Chocolate";
$owner = " Specie: Mouse";
$date = "Adoption: May/09/06";
$gender = " Gender: Male";

$backgroundcolor = imagecolorallocate($mainimage,255,255,255);
$textcolor = imagecolorallocate($mainimage,0,255,0);
$barcolor = imagecolorallocate($mainimage,0,200,0);
$bar2color = imagecolorallocate($mainimage,0,200,0);

Imagestring($mainimage,3,4,3,$name,$textcolor);
Imagestring($mainimage,3,4,18,$owner,$textcolor);
Imagestring($mainimage,3,4,33,$date,$textcolor);
imagestring($mainimage,3,4,48,$gender,$textcolor);

$barwidth = 61+$stat1;
$bar2width = 76+$stat2;

Imagestring($mainimage,4,3,180,"Hunger:",$textcolor);
Imagestring($mainimage,4,3,200,"Solitude:",$textcolor);

imagefilledrectangle($mainimage,60,183,$barwidth,193,$barcolor);
imagerectangle($mainimage,60,182,163,193,$textcolor);
imagefilledrectangle($mainimage,75,203,$bar2width,213,$bar2color);
imagerectangle($mainimage,75,202,172,214,$textcolor);

imagerectangle($mainimage,0,0,399,224,$textcolor);

header("Content-type: image/jpeg");
imagejpeg($mainimage);
imagedestroy($mainimage);
?>


The image file is where you edit the main looks of it, and it's spread out so you can hopefully see what does what, and edit it to your liking. Please don't let my efforts go to waste. At least learn something!
PostPosted: Sat Jul 22, 2006 8:41 pm


Wish I was not so lazy and I could actually try this thing! So is it multiple pets - neopets - or just one that can be fed and such?

z!p


cragwag

PostPosted: Mon Jul 24, 2006 8:46 am


How do I view this? I ucsually upload it to something like geocities, but...well geocities won't display more complex coding like php. What should I do instead, any ideas?
PostPosted: Mon Jul 24, 2006 2:43 pm


cragwag
How do I view this? I ucsually upload it to something like geocities, but...well geocities won't display more complex coding like php. What should I do instead, any ideas?
buy a host or get a better one with not adds. I currently use 5gigs.com but am going to buy a new host shortly.

z!p


cragwag

PostPosted: Tue Jul 25, 2006 2:17 am


z!p
cragwag
How do I view this? I ucsually upload it to something like geocities, but...well geocities won't display more complex coding like php. What should I do instead, any ideas?
buy a host or get a better one with not adds. I currently use 5gigs.com but am going to buy a new host shortly.
Yeah...The problem is I'm kind of broke...
PostPosted: Tue Jul 25, 2006 7:14 am


cragwag
z!p
cragwag
How do I view this? I ucsually upload it to something like geocities, but...well geocities won't display more complex coding like php. What should I do instead, any ideas?
buy a host or get a better one with not adds. I currently use 5gigs.com but am going to buy a new host shortly.
Yeah...The problem is I'm kind of broke...
find a better free one. Try 5gigs - that is if they are accepting - or find a free one with no ads.
Look here.

z!p


Rydian Morrison

PostPosted: Sun Jul 30, 2006 11:01 pm


It's a single pet for a signature, for use on gaia.
PostPosted: Wed Apr 25, 2007 2:30 pm


if your still looking for hosting try out ej.am.

renlok

Reply
Server Side Programming

 
Manage Your Items
Other Stuff
Get GCash
Offers
Get Items
More Items
Where Everyone Hangs Out
Other Community Areas
Virtual Spaces
Fun Stuff
Gaia's Games
Mini-Games
Play with GCash
Play with Platinum