SMF Shop

SMFShop => General SMFShop Discussion => Topic started by: Basil Beard on February 27, 2007, 12:24:31 pm

Title: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on February 27, 2007, 12:24:31 pm
Thats right. The much awaited release of SMFPets is here. You can download it at:

http://dev.dansoftaustralia.net/frs/?group_id=10

Please direct any questions about the mod here. I'll try to answer/fix them as best as I can.

Please also try to break this mod now(on a test board or something) so that such bugs can be fixed before I release an updated version.

Please also suggest any improvements you want to make.

Please note that you must have Shop 3.0(and thus SMF 1.1 or higher to use this mod).

Finally, please have fun. I know you guys have waited a *long* time for this.  O0
Title: Re: SMFPets is Finally Here
Post by: blitzchic on February 27, 2007, 01:35:27 pm
Link isnt working for me :(
Title: Re: SMFPets is Finally Here
Post by: xfollowthereaperx on February 27, 2007, 02:59:08 pm
Link isnt working for me :(
Copy and paste all of it

www.nomicville.com/SMFPets 0.0.zip (http://www.nomicville.com/SMFPets 0.0.zip)
Title: Re: SMFPets is Finally Here
Post by: xfollowthereaperx on February 27, 2007, 03:07:31 pm
Okay, I was the one who got the 1/7 successful test in that other thread.

This time, I'm getting an error even before this, it says "Could not upload package, please check directory permissions!"
Not sure if thats an error or on your part or mine.
Title: Re: SMFPets is Finally Here
Post by: blitzchic on February 27, 2007, 04:25:23 pm
Awesome work Basil!

Only one quick question, how do I resize the gif of the pet?
Title: Re: SMFPets is Finally Here
Post by: Martin on February 27, 2007, 05:24:10 pm
That's awesome, I found a bug though:

SMF Version: 1.1 RC3

When deleting something from the shop, the "Category (X items)" fails to update

Edit:
It updates when I add a new item there though
Title: Re: SMFPets is Finally Here
Post by: Basil Beard on February 27, 2007, 10:10:55 pm
Quote
That's awesome, I found a bug though:

SMF Version: 1.1 RC3

When deleting something from the shop, the "Category (X items)" fails to update

Edit:
It updates when I add a new item there though

That sounds like a SMFShop bug. Talk to Daniel.

Quote
Awesome work Basil!

Only one quick question, how do I resize the gif of the pet?

Pet size isn't set anywhere. Instead, you'll need to change it in the three parts of the code that call the img code. (once in Shop-Pets.php and twice in pet-engine.php. Just search for img tags and you can find it). Easy setting of pet size will be something I hope to add later.

Quote
Okay, I was the one who got the 1/7 successful test in that other thread.

This time, I'm getting an error even before this, it says "Could not upload package, please check directory permissions!"
Not sure if thats an error or on your part or mine.

Sounds like a problem on your end. Try changing the directory premissions on sources/shop and sources/shop/items to 755 or something like that. Not totally sure on exactly what they should be... sorry.

Title: Re: SMFPets is Finally Here
Post by: TechnoDragon on February 28, 2007, 03:04:57 am
i am getting one recurring error...and it happens on multiple lines...but it all deals with the $context['shop_buy_message'] line 148 which is the start of where it builds the listing for the pets available the exact line is
Code: [Select]
$context['shop_buy_message'] .= "<table width='75%' cellpadding='5' cellspacing='0' border='1' align='center'>
and it is an undefined index error

Title: Re: SMFPets is Finally Here
Post by: Martin on February 28, 2007, 03:36:13 am
I noticed a exploit, you can level up your pet without waiting all the time it says, just click "Level It Up!" button and it will gain a level. Please fix this, or maybe I did something wrong?
Title: Re: SMFPets is Finally Here
Post by: Basil Beard on February 28, 2007, 05:02:13 am
There is something wrong with leveling up. I think there is an error with the date check. You can't level up right away, but you also seem to be able to do it before you should. I'll look into it.

I have no idea why you are getting that error, Techno, maybe its due to SMFShop 2.3?
Title: Re: SMFPets is Finally Here
Post by: TechnoDragon on February 28, 2007, 09:43:16 am
possibly...I will take a look at the 3.0 code to see where it is making those calls from....everything seems to be working identical to your site, so I can't see what is supposed to be in the context call....
Title: Re: SMFPets is Finally Here
Post by: xfollowthereaperx on February 28, 2007, 01:27:40 pm
Very very awesome, works perfectly now.

Could someone supply me with some images and how to add different breeds?
Title: Re: SMFPets is Finally Here
Post by: TechnoDragon on February 28, 2007, 02:29:38 pm
With the five items in my zip file
http://www.daniel15.com/forum/index.php/topic,627.msg3322.html#msg3322
there are five items i created for the pets, that can basically be named whatever you like (they cover all of the possibilities i could think of for pets)

@BasilBeard, I checked the 3.0 code and could not see where the pet mod is getting that $context variable from, could you point me in the right direction and I KNOW i can fix it!  Awesome mod by the way...just needs a little more flexibility for changing around the core code (example: i was trying to set variables to use text strings for the health and happiness of the pets, but the return statement didn't like the if statements in there)
Title: Re: SMFPets is Finally Here
Post by: xfollowthereaperx on February 28, 2007, 06:00:22 pm
I love this mod so far but there is so much more you can add to it. I would love to see this mod become a fighting type of system, you buy weapons/items/armor for your pets and you make them duel with other users pets and bet on your pets. You could make your pets evolve like pokemon or whatever as well.

Anyways here are some suggestions:

- Make the arrangement of the Pet Hatchery look like the arrangement of items.
- Fix spelling errors (Description)
- Add around 2 default pets instead of blank to show people how to add them
- Make a way to get rid of pets once you've bought one.
- A way to view other people's pets
- A way to trade pets
- PM the user when his/her pet levels up or can level up... etc
- Make a place that admins can adjust everything a lot more easily

And if you make this mod into a dueling mod, here are some other suggestions:

- Pet battles (They wouldn't be live, it would be like messaging back and forth of two members, members can use items and forfeit and stuff like that.)
- Pet stuff (Weapons, items, armor, so on....)
- Display stats of pets in a better fashion (Heath, Skills, Level, and if you decide to, Armor, Attack... etc.)
- Take and put them in their own section away from the shop, (It would make it less cluttered, easier to use, especially if  you can trade, duel, and stuff like that)

And here are some icons that you can use:

http://www.kidsdomain.com/icon/animalsi.html
Title: Re: SMFPets is Finally Here
Post by: Aruta on February 28, 2007, 07:58:27 pm

Very nice mod!!  O0

Just got some minor bugs to report.

My second breed can not be bought. (first new breed was no problem) As soon as I buy it, the screen changes to where the "you bought this pet" should be, but theres no text there. The Pet also doenst get bought...

This may have something to do with a second bug I found.

In the Pet Hatchery I can see my animals icons, but as soon as i buy them and look them up in "Pet Central" the icons disapear.
Seems its searching for the image in the wrong place. My forum is in "http://www.silverrose.nl/forum/sources/shop/pet_images but in the hatchery its trying to find the image in http://www.silverrose.nl/sources/shop/pet_images



Title: Re: SMFPets is Finally Here
Post by: Basil Beard on February 28, 2007, 09:58:59 pm
Quote
Anyways here are some suggestions:

- Make the arrangement of the Pet Hatchery look like the arrangement of items.
- Fix spelling errors (Description)
- Add around 2 default pets instead of blank to show people how to add them
- Make a way to get rid of pets once you've bought one.
- A way to view other people's pets
- A way to trade pets
- PM the user when his/her pet levels up or can level up... etc
- Make a place that admins can adjust everything a lot more easily

And if you make this mod into a dueling mod, here are some other suggestions:

- Pet battles (They wouldn't be live, it would be like messaging back and forth of two members, members can use items and forfeit and stuff like that.)
- Pet stuff (Weapons, items, armor, so on....)
- Display stats of pets in a better fashion (Heath, Skills, Level, and if you decide to, Armor, Attack... etc.)
- Take and put them in their own section away from the shop, (It would make it less cluttered, easier to use, especially if  you can trade, duel, and stuff like that)

I personally do not see why the hatchery should look like the sotre items. I kinda wanted it to be different in its own way.
I plan on adding more default pets with default skills, but that wasn't needed for a package like this.]
Getting rid of pets and trading pets may be an option in the future, but not for a while.  :P
PMing user would be really really annoying, to the point where I don't think i'll ever code it.
Admin side of things will come eventually, but again wasn't needed for the first release.
Go to a user's profile(On the default theme) and scroll down if you do not think you can view other peoples pets.

Pet battles may be coded *eventually* be not for a while. Coding battles is way *way* more complex than coding pets itself =P.
Pet items(ones that like, reduce training cost or reduce training time) are one of my next goals to code.
What do you mean by "Better fashion"? Lemme know how you want it to look can I'll see what I can do.
Keeping in the shop saves a ton of busy work for me, and really, they are integrated into the shop system. This really is a SMFSop mod, not an SMF mod.

Quote
My second breed can not be bought. (first new breed was no problem) As soon as I buy it, the screen changes to where the "you bought this pet" should be, but theres no text there. The Pet also doenst get bought...

This may have something to do with a second bug I found.

In the Pet Hatchery I can see my animals icons, but as soon as i buy them and look them up in "Pet Central" the icons disapear.
Seems its searching for the image in the wrong place. My forum is in "http://www.silverrose.nl/forum/sources/shop/pet_images but in the hatchery its trying to find the image in http://www.silverrose.nl/sources/shop/pet_images

You do not get any errors when trying to buy the bread? What is the breed name?(Both breedname and filename. Actually, giving me the whole breed file might help) That is the only thing that could be causing it.

As for the image files being wrong, ill look into that as well. I might have use "sources/" instad of "$sourcedir" by accident once or twice in the code.


Anyways, please keep in mind that my main goal was to get the pet mod to this stage--and that while I will spend time debugging it, major features will not be my main coding goal now because i'll want to work on other little projects. So don't expect any of the major stuff I talked about any time soon. Sorry =P
Title: Re: SMFPets is Finally Here
Post by: Alexander on February 28, 2007, 10:34:44 pm
Just a question, how would I be able to delete a pet manually? Also, maybe for getting rid of a pet you could make a item so users can't dispose of pets at their own liking and they have to pay.

One last question, I'm a bit confused about the skills, what is a good example of one, and could they work as items? Say you want a pet to use a skill could your pet get you a random item and give it to you/use it?

Title: Re: SMFPets is Finally Here
Post by: Basil Beard on February 28, 2007, 10:49:29 pm
Here is one of my skills:

Code: [Select]
function use_skill_0() {
global $db_prefix, $ID_MEMBER;
$value = mt_rand(1,10);
$result = db_query("UPDATE {$db_prefix}members SET money = money + {$value} WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);
return "{$this->name} climbs a near-by tree and drops down ".formatMoney($value)." for you to collect!";
}

with corresponding values:

Code: [Select]
$this->skill[0] = new skill;
$this->skill[0]->name = "Tree Climb";
$this->skill[0]->level_learn = 5;
$this->skill[0]->level_max = 10;
$this->skill[0]->cost = 1;

This skill takes 1 SP and gives the user between 1 and 10 credits.

SKills can also give items. One cool trick would be to give items that cannot normally be bought in stores. (This isn't possible with daniel's current build, IIRC, but if you make the changes it could be fun).

Skills can also simply do random stuff. Another of my skills is

Code: [Select]
$this->skill[3] = new skill;
$this->skill[3]->name = "Lucky Number Generation";
$this->skill[3]->level_learn = 1;
$this->skill[3]->level_max = 3;
$this->skill[3]->cost = 1;
...
...
...
function use_skill_3() {
$string = "{$this->name} thinks for a while and says: \"Your lucky numbers are: ";
for ($i = 0; $i < 6; $i++) {
$num = mt_rand(1,40);
$string .= $num." ";
}
$string .= "\"";
return $string;
}

That just gives you 6 lottery numbers =D.

Anyways, you can delete pets through the database--they are stored in shop_pets. Thats the only way you can do it currently. You could always make a DEATH skill for each pet that removes the pet from the database---but there is no way to like, make sure someone doesn't accidentally nuke there pet. XD.
Title: Re: SMFPets is Finally Here
Post by: Aruta on February 28, 2007, 10:58:00 pm
You do not get any errors when trying to buy the bread? What is the breed name?(Both breedname and filename. Actually, giving me the whole breed file might help) That is the only thing that could be causing it.

No errors when buying the breed. When I try to buy a breed now I get the same situation as i get when trying to buy the second breed. I just get a blank notification bar. I must admit that I uploaded the the first breed without buying it. I just edited the blank_pet.php, renamed it and copied it to the directory.  :-[
can that be the problem?

No worries about the extra options, Im really glad with the mod the way it is. And so are my users!  8)

Title: Re: SMFPets is Finally Here
Post by: perplexed on February 28, 2007, 11:56:43 pm
Here is one of my skills:

Code: [Select]
function use_skill_0() {
global $db_prefix, $ID_MEMBER;
$value = mt_rand(1,10);
$result = db_query("UPDATE {$db_prefix}members SET money = money + {$value} WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);
return "{$this->name} climbs a near-by tree and drops down ".formatMoney($value)." for you to collect!";
}

with corresponding values:

Code: [Select]
$this->skill[0] = new skill;
$this->skill[0]->name = "Tree Climb";
$this->skill[0]->level_learn = 5;
$this->skill[0]->level_max = 10;
$this->skill[0]->cost = 1;

This skill takes 1 SP and gives the user between 1 and 10 credits.

SKills can also give items. One cool trick would be to give items that cannot normally be bought in stores. (This isn't possible with daniel's current build, IIRC, but if you make the changes it could be fun).

Skills can also simply do random stuff. Another of my skills is

Code: [Select]
$this->skill[3] = new skill;
$this->skill[3]->name = "Lucky Number Generation";
$this->skill[3]->level_learn = 1;
$this->skill[3]->level_max = 3;
$this->skill[3]->cost = 1;
...
...
...
function use_skill_3() {
$string = "{$this->name} thinks for a while and says: \"Your lucky numbers are: ";
for ($i = 0; $i < 6; $i++) {
$num = mt_rand(1,40);
$string .= $num." ";
}
$string .= "\"";
return $string;
}

That just gives you 6 lottery numbers =D.

Anyways, you can delete pets through the database--they are stored in shop_pets. Thats the only way you can do it currently. You could always make a DEATH skill for each pet that removes the pet from the database---but there is no way to like, make sure someone doesn't accidentally nuke there pet. XD.

I don't know what 'skills' are or what I should do with this code, but the lottery number generator sounds pretty cool.  How would I go about getting that in my shop?  What do I have to do?

~thanks

(have just downloaded pets to test it)
Title: Re: SMFPets is Finally Here
Post by: Alexander on March 01, 2007, 12:03:03 am
Thanks Basil Beard. :)

Also, about the Pet Central problems, this should fix it:

In Pet Engine Find:
Code: [Select]
<img border='0' width='120' height='120' src='".$boardurl."/Sources/shop/pet_images/".$this->breed_img."' alt='".$this->breed."' />Replace with:
Code: [Select]
<center><img border='0' src='".$boardurl."$boardurl."[b]/[your forum directory[/b]]/Sources/shop/pet_images/".$this->breed_img."' alt='".$this->breed."' /></center>I'm not 100% sure it'll fix it, but it will also make the image not resize and will be centered. Also do it for both codes you find.

If my fix doesn't work try:
$boardurl."/$sourcedir/shop/pet_images replacing with $boardurl."/[your forum directory]/Sources/shop/pet_images

Edit-
Also for the rest of the image resizing:

Find in Shop Pets:
Code: [Select]
<img border='0' ' src='".$boardurl."/Sources/shop/pet_images/".$pet->breed_img."' alt='".$pet->breed."' />Replace with:
Code: [Select]
<center><img border='0' ' src='".$boardurl."/Sources/shop/pet_images/".$pet->breed_img."' alt='".$pet->breed."' /></center>
Title: Re: SMFPets is Finally Here
Post by: Alexander on March 01, 2007, 12:54:23 am
Sorry for the double post and all, but I didn't want my last post to be to cluttered.

Would this work for a pet, I know there's probably at least 2-3 errors?
Code: [Select]
<?php
if (!class_exists(pet_Forest_Minish)) { 
class 
pet_Forest_Minish extends petTemplate 
function load_breed() {
$this->breed 'Forest Minish'
$this->breed_desc 'A minish, straight from the woods!';
    
$this->price 250
    
$this->breed_img 'forestminish.gif';
    
$this->skills_cnt 2
        
$this->skill[0] = new skill;
$this->skill[0]->name "Minish Luck";
$this->skill[0]->level_learn 5;
$this->skill[0]->level_max 10;
$this->skill[0]->cost 1;
$this->skill[1] = new skill;
$this->skill[1]->name "Positive pet";
$this->skill[1]->level_learn 2;
$this->skill[1]->level_max 5;
$this->skill[1]->cost 1;
}


function use_skill_0() {
global $db_prefix$ID_MEMBER;
$value mt_rand(1,20);
$result db_query("UPDATE {$db_prefix}members SET money = money + {$value} WHERE ID_MEMBER = {$ID_MEMBER}"__FILE____LINE__);
return "{$this->name} searches a plant and finds ".formatMoney($value)." for you to collect!";
}
function use_skill_1() {
global $db_prefix$ID_MEMBER$item_info;

db_query("
UPDATE 
{$db_prefix}members
SET karmaGood = karmaGood + 
{$item_info[1]}
WHERE ID_MEMBER = 
{$ID_MEMBER}"__FILE____LINE__);
return 'Successfully increased your Karma by ' $item_info[1] . '!';
}
}
}
?>
/code]
Title: Re: SMFPets is Finally Here
Post by: Basil Beard on March 01, 2007, 04:03:13 am
It should work. I don't see why it wouldn't. Are you getting any errors?

Quote
I don't know what 'skills' are or what I should do with this code, but the lottery number generator sounds pretty cool.  How would I go about getting that in my shop?  What do I have to do?

~thanks

Skills are found in the pets files. See the blank_pet.php for more information.


Quote
No errors when buying the breed. When I try to buy a breed now I get the same situation as i get when trying to buy the second breed. I just get a blank notification bar. I must admit that I uploaded the the first breed without buying it. I just edited the blank_pet.php, renamed it and copied it to the directory.  Embarrassed
can that be the problem?

No worries about the extra options, Im really glad with the mod the way it is. And so are my users!  Cool

Sounds like the problem is a bad txt file. Are you sure that you should be able to buy the pet(That is, you have enough pet spaces and money)?
Title: Re: SMFPets is Finally Here
Post by: xfollowthereaperx on March 01, 2007, 04:08:50 am
Pet battles may be coded *eventually* be not for a while. Coding battles is way *way* more complex than coding pets itself =P.
:D OMG YAY
Title: Re: SMFPets is Finally Here
Post by: Alexander on March 01, 2007, 04:20:07 am
I just tested it out, I'm getting:
Code: [Select]
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE ID_MEMBER = 1' at line 3
File: /home/zeldaevo/public_html/forums/Sources/shop/pets_breeds/Forest_Minish.php
Line: 36
Title: Re: SMFPets is Finally Here
Post by: Basil Beard on March 01, 2007, 04:30:17 am
Code: [Select]
SET karmaGood = karmaGood + {$item_info[1]}
$item_info[1] is not defined. try changing that to karmaGood = karmaGood + 1

=)

Quote
OMG YAY

What part about "may" "eventually" and "really really hard" didn't you understand  :P
Title: Re: SMFPets is Finally Here
Post by: TechnoDragon on March 01, 2007, 05:28:33 am
ok, here's an example of what i am describing....
This is the original code which is the function  view_pet_owner
Code: [Select]
return "
<table width='75%' cellpadding='5' cellspacing='0' border='1' align='center'>
<tr 'titlebg2'><th colspan='6'>".$this->name." the ".$this->breed."</th></tr>
<tr><td colspan='1' rowspan='3' width='10%'><img border='0' width='120' height='120' src='".$boardurl."/Sources/shop/pet_images/".$this->breed_img."' alt='".$this->breed."' />
    <th colspan='1' width='20%'>".$txt['pets_name']."</th>
    <td colspan='1'>".$this->name."</td>
    <th colspan='1' width='20%'>".$txt['pets_breed']."</th>
<td colspan='2'>".$this->breed."</td></tr>
<tr><th colspan='1' width='10%'>".$txt['pets_happy']."</th>
<td colspan='1'>".$this->happy."</td>
<th colspan='1'>".$txt['pets_hunger']."</th>
<td colspan='1'>".$this->hunger."</td></tr>
<tr><th colspan='1' width='20%'>".$txt['pets_level']."</th>
<td colspan='1'>".$this->level."</td>
<th colspan='1' width='20%'>".$txt['pets_age']."</th>
<td colspan='2'>".sprintf($txt['pets_days'], $this->age)."</td></tr>
<tr><th colspan='1'>".$txt['pets_description']."</th>
<td colspan='5'>".$this->desc."</td></tr>
<tr><th colspan='6'>".$txt['pets_do_stuff'].$this->curap."/".$this->maxap.")</th></tr>
<tr><th colspan='1' width='10%'>".$txt['pets_use_skill']."</th>
<td colspan='2'>".$this->skillsMenu()."</td>
<th colspan='1' width='10%'>".$txt['pets_train']."</th>
<td colspan='2'>".$this->trainMenu()."</td></tr>
<tr><th colspan='1' width='10%'>".$txt['pets_rename']."</th>
<td colspan='2'>".$this->renameMenu()."</td>
<th colspan='1' width='10%'>".$txt['pets_describe']."</th>
<td colspan='2'>".$this->describeMenu()."</td></tr></table><br />";

here's what i would like to do (at least in the early stages):
Code: [Select]
        echo' <table width="75%" cellpadding="5" cellspacing="0" border="1" align="center">
<tr "titlebg2"><th colspan="6">'.$this->name.' the '.$this->breed.'</th></tr>
<tr><td colspan="1" rowspan="3" width="10%"><img border="0" width="120" height="120" src="'.$boardurl.'/Sources/shop/pet_images/'.$this->breed_img.'" alt="'.$this->breed.'" />
    <th colspan="1" width="20%">'.$txt['pets_name'].'</th>
    <td colspan="1">'.$this->name.'</td>
    <th colspan="1" width="20%">'.$txt['pets_breed'].'</th>
<td colspan="2">'.$this->breed.'</td></tr>
<tr><th colspan="1" width="10%">'.$txt['pets_happy'].'</th>';
                if ($this->happy < 10 && $this->happy > 9){
                  echo'
<td colspan="1">Joyous</td>';
                }
                elseif($this->happy < 9 && $this->happy > 5){
                  echo'
<td colspan="1">Content</td>';
                }
                elseif($this->happy < 5 && $this->happy > 1){
                  echo'
<td colspan="1">Depressed</td>';
                }
                elseif($this->happy <= 1){
                  echo'
<td colspan="1">Angry</td>';
                }
                else{
                  echo'
<td colspan="1">Excstatic</td>';
                }
echo'
                <th colspan="1">'.$txt['pets_hunger'].'</th>
<td colspan="1">'.$this->hunger.'</td></tr>
<tr><th colspan="1" width="20%">'.$txt['pets_level'].'</th>
<td colspan="1">'.$this->level.'</td>
<th colspan="1" width="20%">'.$txt['pets_age'].'</th>
<td colspan="2">'.sprintf($txt['pets_days'], $this->age).'</td></tr>
<tr><th colspan="1">'.$txt['pets_description'].'</th>
<td colspan="5">'.$this->desc.'</td></tr>
<tr><th colspan="6">'.$txt['pets_do_stuff'].$this->curap.'/'.$this->maxap.')</th></tr>
<tr><th colspan="1" width="10%">'.$txt['pets_use_skill'].'</th>
<td colspan="2">'.$this->skillsMenu().'</td>
<th colspan="1" width="10%">'.$txt['pets_train'].'</th>
<td colspan="2">'.$this->trainMenu().'</td></tr>
<tr><th colspan="1" width="10%">'.$txt['pets_rename'].'</th>
<td colspan="2">'.$this->renameMenu().'</td>
<th colspan="1" width="10%">'.$txt['pets_describe'].'</th>
<td colspan="2">'.$this->describeMenu().'</td></tr></table><br />';

if i do that it makes the pet display at the top of the page before the forum is even rendered.
Title: Re: SMFPets is Finally Here
Post by: xfollowthereaperx on March 01, 2007, 06:15:45 am
What part about "may" "eventually" and "really really hard" didn't you understand  :P
The part where you said it might happen

Very awesome code TechnoDragon  :smitten:
Title: Re: SMFPets is Finally Here
Post by: Basil Beard on March 01, 2007, 06:32:50 am
The number one rule of coding with SMF is: "If it is not a template file, DO NOT ECHO" =D.
Also, simply to have nicer code, I would suggest

Code: [Select]
switch ($this->happy) {
     case 0,1: $mood = "Angry"; break;
     case 2,3,4: $mood = "Depressed"; break;
     case 5,6,7,8,9: $mood = "Content"; break;
     case 10,11,12,13,14,15: $mood = "Joyous"; break;
     default: $mood = "Excstatic"; break;
}

        return' <table width="75%" cellpadding="5" cellspacing="0" border="1" align="center">
<tr "titlebg2"><th colspan="6">'.$this->name.' the '.$this->breed.'</th></tr>
<tr><td colspan="1" rowspan="3" width="10%"><img border="0" width="120" height="120" src="'.$boardurl.'/Sources/shop/pet_images/'.$this->breed_img.'" alt="'.$this->breed.'" />
    <th colspan="1" width="20%">'.$txt['pets_name'].'</th>
    <td colspan="1">'.$this->name.'</td>
    <th colspan="1" width="20%">'.$txt['pets_breed'].'</th>
<td colspan="2">'.$this->breed.'</td></tr>
<tr><th colspan="1" width="10%">'.$txt['pets_happy'].'</th>
<td colspan="1">'.$mood.'</td>
                <th colspan="1">'.$txt['pets_hunger'].'</th>
<td colspan="1">'.$this->hunger.'</td></tr>
<tr><th colspan="1" width="20%">'.$txt['pets_level'].'</th>
<td colspan="1">'.$this->level.'</td>
<th colspan="1" width="20%">'.$txt['pets_age'].'</th>
<td colspan="2">'.sprintf($txt['pets_days'], $this->age).'</td></tr>
<tr><th colspan="1">'.$txt['pets_description'].'</th>
<td colspan="5">'.$this->desc.'</td></tr>
<tr><th colspan="6">'.$txt['pets_do_stuff'].$this->curap.'/'.$this->maxap.')</th></tr>
<tr><th colspan="1" width="10%">'.$txt['pets_use_skill'].'</th>
<td colspan="2">'.$this->skillsMenu().'</td>
<th colspan="1" width="10%">'.$txt['pets_train'].'</th>
<td colspan="2">'.$this->trainMenu().'</td></tr>
<tr><th colspan="1" width="10%">'.$txt['pets_rename'].'</th>
<td colspan="2">'.$this->renameMenu().'</td>
<th colspan="1" width="10%">'.$txt['pets_describe'].'</th>
<td colspan="2">'.$this->describeMenu().'</td></tr></table><br />';

But yeah. Do not echo stuff. When you echo stuff stuff appears on the top and everyone is very, very sad. =P
Title: Re: SMFPets is Finally Here
Post by: TechnoDragon on March 01, 2007, 07:14:50 am
Ahhh, see that is a different method of coding than i am used to (most everything i have done is with source and template files)

i will give that a shot tonight and see what happens...have i told you this is an awesome mod yet?

other than the $context error it is working flawlessly...i have waited to code skills and pets until i "tweak" a few settings, but once i do i will make most of them available for everyone here!  if anyone has any ideas for additional items let me know and i will try to make them happen (trying to take some of the load off of you basilbeard)
Title: Re: SMFPets is Finally Here
Post by: perplexed on March 01, 2007, 09:29:18 am
I installed this today and hopefully did it right.  I uploaded a cat and copied the blank_pet.php and called it cat_pet.php

I uploaded a cat imge to the pet images folder

If I go to the hatchery I can see the cat image, I bought a cat.  When I look in the pet central at my pet there is no image - see attachment.

did I do something wrong?  should there be a pet pic there?

Title: Re: SMFPets is Finally Here
Post by: Alexander on March 01, 2007, 10:25:35 am
Check this out, it should work.

http://www.daniel15.com/forum/index.php/topic,642.msg3363.html
Title: Re: SMFPets is Finally Here
Post by: Basil Beard on March 01, 2007, 10:37:23 am
Yeah. Thats a glitch, I guess. I had to code a C++ homework project tonight, and wasn't able to fix anything. Should have time tomorrow though =P.
Title: Re: SMFPets is Finally Here
Post by: TechnoDragon on March 01, 2007, 11:52:33 am
Thanks for the info BasilBeard!  I did what you suggested using the switch...and it is now working perfectly!  I also did a bit of editing so that the level up button disappears while the pet is training!  I have also begun working on a variety of different skills for pets and several pets themselves!

With your permission, my partner helping me write my avatar maker (which also combines with the shop) would like to take this to a new level...we want to code in a "combat mod" of sorts for this....
Title: Re: SMFPets is Finally Here
Post by: Basil Beard on March 01, 2007, 12:44:14 pm
You mean like a combat system? That would be totally awesome... because it means I wouldn't have to do it. XD!
Title: Re: SMFPets is Finally Here
Post by: TechnoDragon on March 01, 2007, 02:07:39 pm
You mean like a combat system? That would be totally awesome... because it means I wouldn't have to do it. XD!

Yes actually that is exactly what i mean...we are putting the final touches on an rpg system using my avatar maker, and wanted to use your pet mod to create a forum battle system using the pets and the avatars people make....
Title: Re: SMFPets is Finally Here
Post by: xfollowthereaperx on March 01, 2007, 04:15:58 pm
Thanks for the info BasilBeard!  I did what you suggested using the switch...and it is now working perfectly!  I also did a bit of editing so that the level up button disappears while the pet is training!  I have also begun working on a variety of different skills for pets and several pets themselves!

With your permission, my partner helping me write my avatar maker (which also combines with the shop) would like to take this to a new level...we want to code in a "combat mod" of sorts for this....
I love you so much  :smitten:
Title: Re: SMFPets is Finally Here
Post by: perplexed on March 01, 2007, 10:04:54 pm
Thanks Basil Beard. :)

Also, about the Pet Central problems, this should fix it:

In Pet Engine Find:
Code: [Select]
<img border='0' width='120' height='120' src='".$boardurl."/Sources/shop/pet_images/".$this->breed_img."' alt='".$this->breed."' />Replace with:
Code: [Select]
<center><img border='0' src='".$boardurl."$boardurl."[b]/[your forum directory[/b]]/Sources/shop/pet_images/".$this->breed_img."' alt='".$this->breed."' /></center>I'm not 100% sure it'll fix it, but it will also make the image not resize and will be centered. Also do it for both codes you find.

If my fix doesn't work try:
$boardurl."/$sourcedir/shop/pet_images replacing with $boardurl."/[your forum directory]/Sources/shop/pet_images

Edit-
Also for the rest of the image resizing:

Find in Shop Pets:
Code: [Select]
<img border='0' ' src='".$boardurl."/Sources/shop/pet_images/".$pet->breed_img."' alt='".$pet->breed."' />Replace with:
Code: [Select]
<center><img border='0' ' src='".$boardurl."/Sources/shop/pet_images/".$pet->breed_img."' alt='".$pet->breed."' /></center>


I can't get this to work,  I get parse errors:

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/mysite/public_html/testforum/Sources/shop/pet_engine.php on line 76

I still have no pet pictures in pet central   :'( :'(
Title: Re: SMFPets is Finally Here
Post by: tomekent on March 02, 2007, 07:05:18 am
this is some great stuff, i'd love to see a new topic for all the skills, so we could just add them to our pets.
Title: Re: SMFPets is Finally Here
Post by: xfollowthereaperx on March 02, 2007, 08:03:21 am
Here are some stats that I think should be included if the combat system is going to be put in place.

Health
Happiness
Hunger
Attack
Defense
Stamina/Magic

I think Hunger and Happiness should be very basic and users shouldn't have to worry too much about these.
I think that your pets should faint instead of die so that it's easier on the user who owns them.

Hope to see these things pretty soon, and be sure to make the pets as basic as possible  O0
Title: Re: SMFPets is Finally Here
Post by: Daniel15 on March 02, 2007, 05:06:09 pm
Nice work Basil Beard, people have been asking me about this for ages  O0

The number one rule of coding with SMF is: "If it is not a template file, DO NOT ECHO" =D.
SMFShop, you mean ;). SMF uses echo statements in the templates, but the way SMFShop works is different (yeah, I know, it's fundamentally flawed, but I wanted to have nice self-contained items :)

Quote
Also, simply to have nicer code, I would suggest
For nicer code, I'd suggest that everyone read through http://custom.simplemachines.org/mods/guidelines.php :D
Title: Re: SMFPets is Finally Here
Post by: tomekent on March 02, 2007, 05:20:36 pm
is there a way that you could view each others pets?
Title: Re: SMFPets is Finally Here
Post by: TechnoDragon on March 02, 2007, 09:34:39 pm
There is a link on every profile to view the pets that a particular member has
Title: Re: SMFPets is Finally Here
Post by: tomekent on March 02, 2007, 10:52:21 pm
im using a different theme though so it doesnt show up
Title: Re: SMFPets is Finally Here
Post by: TechnoDragon on March 02, 2007, 10:53:34 pm
You'll have to make the edit to the profile.template.php to show the link...
Title: Re: SMFPets is Finally Here
Post by: tomekent on March 02, 2007, 10:56:28 pm
i see it in bablylon theme, is there a bit of code i could put in one of the files to make it visible, prerferable a picture button that i could add instead of just text.
Title: Re: SMFPets is Finally Here
Post by: TechnoDragon on March 03, 2007, 04:46:23 am
Well, the link that is placed is textual, just like the other profile links...

In other news, I have fixed it so that while your pets are training the button disappears and when they are done the button reappears to finish...

In pet_engine.php find the function trainMenu replace the entire function with this:
Code: [Select]
function trainMenu() {
global $txt, $scripturl;
   $date = date('z');
   if ($date < 10) {
   $date = '00'.$date;
   }
   elseif ($date < 100) {
   $date = '0'.$date;
   }
   $date = date('y').$date.date('H');
if ($this->training == 1) {
if ($date > ($this->training_date($this->trainingend))){
$middlestring = $txt['pets_course_finish2'];
$command = $txt['pets_train_pet'];
$returnstring = "<form method='post' action='".$scripturl."?action=shop;do=pets;type=train;pet=".$this->id."'> ";
$returnstring .= $middlestring;
$returnstring .= " <input type='submit' value='{$command}'></form>";
}
else{
$middlestring = sprintf($txt['pets_course_taking'], $this->training_date($this->trainingend));
$command = $txt['pets_train_pet'];
$returnstring = "<form method='post' action='".$scripturl."?action=shop;do=pets;type=train;pet=".$this->id."'> ";
$returnstring .= $middlestring;
}
}
else {
$middlestring = $txt['pets_train_cost'].$this->calcTrainCost();
$command = $txt['pets_train'];
$returnstring = "<form method='post' action='".$scripturl."?action=shop;do=pets;type=train;pet=".$this->id."'> ";
$returnstring .= $middlestring;
$returnstring .= " <input type='submit' value='{$command}'></form>";
}
return $returnstring;
}

And add this line to the shop.english.php
Code: [Select]
$txt['pets_course_finish2'] = 'Your pet has completed its course!';
Title: Re: SMFPets is Finally Here
Post by: Alexander on March 03, 2007, 06:13:17 am
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's Neil but Jr.!',
hunger = 9,
age = 1,
train' at line 7
File: /home/zeldaevo/public_html/forums/Sources/shop/pet_engine.php
Line: 236



One of my members bought a pet, and got this error, and now the whole shop's down.
Title: Re: SMFPets is Finally Here
Post by: TechnoDragon on March 03, 2007, 06:23:19 am
's Neil but Jr.

what is that from?

Basically, you need to escape the apostrophe with an \ right before it
Title: Re: SMFPets is Finally Here
Post by: Alexander on March 03, 2007, 06:52:42 am
The persons pet is named Neil Jr, and the description is :"I's Neil but Jr.!", should I just tell him to delete the apostrophe?

http://www.zeldaevolution.com/forums/index.php?action=profile;u=25;sa=showPets
Title: Re: SMFPets is Finally Here
Post by: TechnoDragon on March 03, 2007, 07:09:00 am
that or escape it...either way will get rid of the error
 EDIT:

For some reason the pet mod will not read anything but the first skill...I have them set properly
Code: [Select]
$this->skill[1] = new skill;       //Required for making new skills.

but it only will list the first one.
Title: Re: SMFPets is Finally Here
Post by: Basil Beard on March 03, 2007, 11:12:31 am
Is skills_cnt set to the right value? Are they zero indexed.

I always thought SMF auto escaped quote marks. I guess I could just add that to the desc and name code, wouldn't be too hard.

Quote
The number one rule of coding with SMF is: "If it is not a template file, DO NOT ECHO" =D.
SMFShop, you mean Wink. SMF uses echo statements in the templates, but the way SMFShop works is different (yeah, I know, it's fundamentally flawed, but I wanted to have nice self-contained items Smiley

That was sorta my point. Nothing gets echoed if it is not in a template. Different mods use different templates to different degrees of use--but you still don't echo without a template, right?
Title: Re: SMFPets is Finally Here
Post by: TechnoDragon on March 03, 2007, 11:36:43 am
ROFL

Didn't even notice that variable!

Title: Re: SMFPets is Finally Here
Post by: Alexander on March 04, 2007, 03:26:16 am
that or escape it...either way will get rid of the error
Sorry but I'm still confused about it, where would I find what I need to change?
Title: Re: SMFPets is Finally Here
Post by: TechnoDragon on March 04, 2007, 05:04:26 am
most likely in the database for the pet description
Title: Re: SMFPets is Finally Here
Post by: littleone on March 06, 2007, 01:12:55 pm
Will this work or am I off here ?  I think the return statement is wrong I didnt know what to do lol

Code: [Select]
function use_skill_2() {
global $db_prefix, $ID_MEMBER;
$value = mt_rand(1,5);
$result = db_query("UPDATE {$db_prefix}members SET maxap = maxap + {$value} WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);
return "{$this->name} climbs a near-by tree and drops down ".$value." to your skill points!";
}
Title: Re: SMFPets is Finally Here
Post by: littleone on March 06, 2007, 01:28:00 pm
Also.... what does this refer to:

$this->skills_cnt = 1; //The number of skills the pet can use

as in the skill[0] would mean the count should be one and if you have skill[1] or [2] the count should be 2 or 3 respectively?




Another thing...

What is the difference between the Increase Skill and the Restore Skill files? The only thing I noticed different between the two was maxap and curap.

Does that mean that a user can only have so many skill points?  Like I have certain skills that require 25 points, would that not work or am i just missing something in the 2 files that makes them difference?
Title: Re: SMFPets is Finally Here
Post by: TechnoDragon on March 06, 2007, 03:07:09 pm
ok, first the two files, one restores used akill points rather than wait until the next day...the max ap (skill oints) raises the maximum number of skill points your pet can have.

Third, yes I found that out too, the skills_cnt refers to the number of skills they can have...so if you make a pet and create three skills for it you have to change that to 3
Title: Re: SMFPets is Finally Here
Post by: Aruta on March 06, 2007, 08:28:19 pm

Well I fixed most of my problems with the stuff posted here. Is all this going to be added to a new release?

Also I still have 1 problem. I created two breeds now, but since I bought a second pets (diffenent breed) I cant feed my first pet.
When I select the food item the pull-down menu only shows my last pet, not the first.
Is there a way to fix this? If I need to post more info please let me know and I will do that asap.

Thanx in advance!
Title: Re: SMFPets is Finally Here
Post by: TechnoDragon on March 06, 2007, 09:08:31 pm
i will take a look at the code in that item to see what's wrong later today...thanks for the info!
Title: Re: SMFPets is Finally Here
Post by: Basil Beard on March 06, 2007, 10:33:46 pm
I think the error is in the food item I included. I remember fixing it, but I don't think I fixed it before the last release. I'll fix it in the next release(hopefully in a few days) but for now, just do replace the whole getUseInput() function with this::

Code: [Select]
function getUseInput()
{
global $db_prefix, $ID_MEMBER;

$result = db_query("SELECT numpets FROM {$db_prefix}members WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);
$row = mysql_fetch_assoc($result);
if ($row['numpets'] == 0) {
return "You have no pets. Using this item will simply cause it to die and you to lose money.";
}
$string .= "<select name = 'petid'>";
$result = db_query("SELECT * FROM {$db_prefix}shop_pets WHERE ownerid = {$ID_MEMBER}", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($result)) {
$string .= "<option value = '{$row['pet_id']}'>{$row['name']}</option>";
}
$string .= "</select>";
return "Select a pet to give this item to: ".$string;
}
Title: Re: SMFPets is Finally Here
Post by: littleone on March 07, 2007, 12:49:34 am
ok, first the two files, one restores used akill points rather than wait until the next day...the max ap (skill oints) raises the maximum number of skill points your pet can have.


Ok I am still confused.  The Pets come with a Max skill points they have?  Where is that set, I didnt notice any such thing.  My last skill (of 4 skills) on one of my pets requires 20 points.  So i am a bit confused as to the difference between the max and the cur.  Basically the owner would need 20 points to reach the final skill.  Is there a limit someplace that would stop them from reaching 20 unless they used the one to raise the maxap?

Thanks

Code: [Select]
<?php
if (!class_exists(pet_Siamese_pet)) { //Make sure name matches php file
class pet_Siamese_pet extends petTemplate //Make sure name matches php file
function load_breed() {
$this->breed 'Siamese Cat'//The name of the breed(Use _ instead of whitespace or else Baby Jesus will cry)
$this->breed_desc 'This is a Siamese Cat'//The description of the breed.
    
$this->price 2000//The price to purchase one of these pets
    
$this->breed_img 'siamese.gif'//The img file of the breed
    
$this->skills_cnt 4//The number of skills the pet can use
        
    //Sample skill. For each addtional skill, increase the index by one.(So your next skill would be $this->skill[1])
$this->skill[0] = new skill;       //Required for making new skills. 
$this->skill[0]->name "Purr";   //Name of skill
$this->skill[0]->level_learn 1;  //Level the pet learns the skill
$this->skill[0]->level_max 2;    //Level the pet masters the skill
$this->skill[0]->cost 1;         //Cost, in skill points, of the skill.
$this->skill[1] = new skill;
$this->skill[1]->name "Use Litter Box";
$this->skill[1]->level_learn 2;
$this->skill[1]->level_max 4;
$this->skill[1]->cost 3;
$this->skill[2] = new skill;
$this->skill[2]->name "Tree Climb";
$this->skill[2]->level_learn 5;
$this->skill[2]->level_max 10;
$this->skill[2]->cost 8;
$this->skill[3] = new skill;
$this->skill[3]->name "Premier Cat Show Worthy";
$this->skill[3]->level_learn 10;
$this->skill[3]->level_max 20;
$this->skill[3]->cost 20;
}

//Sample skill function. A different function is needed for each skill. Skill function should be named "use_skill_i" where i is that skills index.
//Code these skills like you would code the action part of items. Currently input cannot be given into skills. Sorry.
function use_skill_0() {
global $db_prefix$ID_MEMBER;
return "{$this->name} has learned to Purr!";
}
function use_skill_1() {
global $db_prefix$ID_MEMBER;
$value mt_rand(30,600);
$result db_query("UPDATE {$db_prefix}members SET money = money + {$value} WHERE ID_MEMBER = {$ID_MEMBER}"__FILE____LINE__);
return ($this->name 'learned to use the litter box and "materialized"' formatMoney($value) / ' tokens for you!');
}
        function 
use_skill_2() {
global $db_prefix$ID_MEMBER;
$value mt_rand(80,1600);
$result db_query("UPDATE {$db_prefix}members SET money = money + {$value} WHERE ID_MEMBER = {$ID_MEMBER}"__FILE____LINE__);
return "{$this->name} climbs a near-by tree and drops down ".formatMoney($value)." tokens!";
}
function use_skill_3() {
global $db_prefix$ID_MEMBER;
$value mt_rand(200,4000);
$result db_query("UPDATE {$db_prefix}members SET money = money + {$value} WHERE ID_MEMBER = {$ID_MEMBER}"__FILE____LINE__);
return "{$this->name} place in a Premier Cat Show and earned you ".formatMoney($value)." tokens!";
}
}
}
?>
Title: Re: SMFPets is Finally Here
Post by: perplexed on March 07, 2007, 01:00:58 am
Thanks Basil Beard. :)

Also, about the Pet Central problems, this should fix it:

In Pet Engine Find:
Code: [Select]
<img border='0' width='120' height='120' src='".$boardurl."/Sources/shop/pet_images/".$this->breed_img."' alt='".$this->breed."' />Replace with:
Code: [Select]
<center><img border='0' src='".$boardurl."$boardurl."[b]/[your forum directory[/b]]/Sources/shop/pet_images/".$this->breed_img."' alt='".$this->breed."' /></center>I'm not 100% sure it'll fix it, but it will also make the image not resize and will be centered. Also do it for both codes you find.

If my fix doesn't work try:
$boardurl."/$sourcedir/shop/pet_images replacing with $boardurl."/[your forum directory]/Sources/shop/pet_images

Edit-
Also for the rest of the image resizing:

Find in Shop Pets:
Code: [Select]
<img border='0' ' src='".$boardurl."/Sources/shop/pet_images/".$pet->breed_img."' alt='".$pet->breed."' />Replace with:
Code: [Select]
<center><img border='0' ' src='".$boardurl."/Sources/shop/pet_images/".$pet->breed_img."' alt='".$pet->breed."' /></center>


I can't get this to work,  I get parse errors:

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/mysite/public_html/testforum/Sources/shop/pet_engine.php on line 76

I still have no pet pictures in pet central   :'( :'(

hi

is there a solution for this as I cant release it on a live forum until its resolved?  I tried the above code but it didnt work, any other help appreciated

~Thanks
Title: Re: SMFPets is Finally Here
Post by: Basil Beard on March 07, 2007, 02:52:24 am
ok, first the two files, one restores used akill points rather than wait until the next day...the max ap (skill oints) raises the maximum number of skill points your pet can have.


Ok I am still confused.  The Pets come with a Max skill points they have?  Where is that set, I didnt notice any such thing.  My last skill (of 4 skills) on one of my pets requires 20 points.  So i am a bit confused as to the difference between the max and the cur.  Basically the owner would need 20 points to reach the final skill.  Is there a limit someplace that would stop them from reaching 20 unless they used the one to raise the maxap?

Thanks

Curap gets consumed whenever you use a skill. If you have 6 curap and you use a skill that costs 3 sp you current skill points will drop to 3.
Each night, curap recharges to whatever maxap is. So if your maxp is 6, then no matter how many sp you used, your curap will start the new day at 6. It cannot get any higher than maxap.

Maxap can be increased in a number of ways--you can increase it via levels, via items, or maybe even by skills. The code is set up so that it increases by level---but you can easily change that.  O0
Title: Re: SMFPets is Finally Here
Post by: xfollowthereaperx on March 07, 2007, 07:31:50 am
Hello guys, is there any updates packaged? I'm a little confused with all the codes going around and I'd like to use some of the new things like viewing people's pets
Title: Re: SMFPets is Finally Here
Post by: Aruta on March 07, 2007, 07:43:31 pm
I'm a little confused with all the codes going around and I'd like to use some of the new things like viewing people's pets

Ya dont have to code dude. You van view peoples pets bij clikcing on their forum name en clicking on the "view pet" link beneath their profile.
Title: Re: SMFPets is Finally Here
Post by: xfollowthereaperx on March 08, 2007, 06:29:07 am
I'm a little confused with all the codes going around and I'd like to use some of the new things like viewing people's pets

Ya dont have to code dude. You van view peoples pets bij clikcing on their forum name en clicking on the "view pet" link beneath their profile.

Whose forum has it?  :P
Title: Re: SMFPets is Finally Here
Post by: Basil Beard on March 08, 2007, 10:10:18 am
You need to have the default skin. If you don't--just look at the profile.template file for the default skin and manually apply the same changes to your skin.
Title: Re: SMFPets is Finally Here
Post by: blitzchic on March 08, 2007, 01:09:35 pm
Hi everyone, maybe its a stupid question, but how do we feed our pets?
Title: Re: SMFPets is Finally Here
Post by: TechnoDragon on March 08, 2007, 01:17:26 pm
using either basil beards food item or the one i created
Title: Re: SMFPets is Finally Here
Post by: blitzchic on March 08, 2007, 02:44:42 pm
Sorry Technodragon - I am still unsure how to do that!

I have uploaded food.php .. but theres no drop down menu anyway to feed my pet :(
Title: Re: SMFPets is Finally Here
Post by: TechnoDragon on March 08, 2007, 09:37:21 pm
Ahhh, then THAT would appear to be an error then!

don't suppose you could post a screen shot of when you are trying to use the item to feed your pet?
Title: Re: SMFPets is Finally Here
Post by: Basil Beard on March 08, 2007, 11:50:08 pm
Like I have said, I donno how Techno's food item works, but mine had a glitch. I appear I showed how to fix it a few pages ago.
Title: Re: SMFPets is Finally Here
Post by: Aruta on March 09, 2007, 02:59:50 am
Like I have said, I donno how Techno's food item works, but mine had a glitch. I appear I showed how to fix it a few pages ago.

Well this fix (http://www.daniel15.com/forum/index.php/topic,642.msg3485.html#msg3485) works great  for me. My pets can eat again!  :)
Thanx man.
Title: Re: SMFPets is Finally Here
Post by: xfollowthereaperx on March 09, 2007, 05:01:45 am
You need to have the default skin. If you don't--just look at the profile.template file for the default skin and manually apply the same changes to your skin.
Im not sure if you're talking to me but I just looked at my default skin and it didn't have view pets

I installed the 0.0 pets without adding any codes or modifying anything
Title: Re: SMFPets is Finally Here
Post by: Basil Beard on March 09, 2007, 05:49:28 am
Thats very strange. The package should work for whatever SMF's default skin is called. (not the one that you have set as default). Has anyone else had any problems with this part of the code?
Title: Re: SMFPets is Finally Here
Post by: Aruta on March 09, 2007, 10:33:12 pm

No problems here. My default skin is renamed and everything and I now use the WoW Theme by StormLrd.
And I can view the pets.

Maybe xfollowthereaperx can post a screenshot of a user profile?
Title: Re: SMFPets is Finally Here
Post by: Althea on March 12, 2007, 04:37:25 pm
Nice work on the mod.  Seeing that I really suck with adding any sort of coding at all into anything I'm going to wait to install this on my forum for a little while, but I'm looking forward to when I can ;D
Title: Re: SMFPets is Finally Here
Post by: inkstains on March 13, 2007, 02:49:42 am
first up crazy mod with mad potential really liking it so far. props.

i want to add a link to a members pets just above the "view inventory" link on the left hand side of a members post, any ideas on how i would do this i imagine i need to add similar code to the display.template.php file of my theme as what is in the profile.template.php

profile.template.php code
Code: [Select]
<a href="', $scripturl, '?action=profile;u=', $context['member']['id'], ';sa=showPets">', $txt['profile_show_pets'], '.</a><br />

but there are some differences between the two as you can see from the above and below code


display.template.php
Code: [Select]
<a href="', $scripturl, '?action=shop;do=invother2;member=', $message['member']['username'], '">View Inventory</a><br />
i've tried to edit it but my understanding of php is very limited at the moment (though i'm slowly learning)

any help would be appreciated


my second issue is the lack of displayed pictures in pet central though they show up fine in pet hatchery i've tried the below with each of the options recommended though if i follow the first instruction and paste in the code reccomended i get an error, but with the changing of  $this->breed to $pet->breed it stops bugging out though i still have no images in pet central i've also tried the addition of /forum/ to it with no luck


Thanks Basil Beard. :)

Also, about the Pet Central problems, this should fix it:

In Pet Engine Find:
Code: [Select]
<img border='0' width='120' height='120' src='".$boardurl."/Sources/shop/pet_images/".$this->breed_img."' alt='".$this->breed."' />Replace with:
Code: [Select]
<center><img border='0' src='".$boardurl."$boardurl."[b]/[your forum directory[/b]]/Sources/shop/pet_images/".$this->breed_img."' alt='".$this->breed."' /></center>I'm not 100% sure it'll fix it, but it will also make the image not resize and will be centered. Also do it for both codes you find.

If my fix doesn't work try:
$boardurl."/$sourcedir/shop/pet_images replacing with $boardurl."/[your forum directory]/Sources/shop/pet_images

Edit-
Also for the rest of the image resizing:

Find in Shop Pets:
Code: [Select]
<img border='0' ' src='".$boardurl."/Sources/shop/pet_images/".$pet->breed_img."' alt='".$pet->breed."' />Replace with:
Code: [Select]
<center><img border='0' ' src='".$boardurl."/Sources/shop/pet_images/".$pet->breed_img."' alt='".$pet->breed."' /></center>


any help with any of these would be appreciated



EDIT: I've resorted to creating a new Sources/shop/pet_images/ folder path on the main url and got the images working in pet central but would still like to get it working correctly


EDIT 2: been thinking would it be possible to be able to trade the pets through the trade centre? also could we have a section where a person would be able to design there own pet through a form with a series of inputs like levels to gain, description, skills, etc  i'm fairly sure it would be possible and i'd be keen to do it if no one can be bothered can someone just point me in the right direction. also the battle mod that was mentioned throughout this thread any word on this anything that can be done to help?
Title: Re: SMFPets is Finally Here
Post by: Lady Ambrosia on March 14, 2007, 01:19:54 pm
First off before I say anything.....*grabs Basil Beard and gives him a HUGE KISS MUAH!! and hug  THEN grabs TechnoDragon and does the same*  THANK YOU THANK YOU THANK YOU!!!  Thank You Basil Beard for creating this WONDERFUL little mod!!   And thank you TechnoDragon for spending time with helping out with different codes and other things to go with it!!!

I've not installed this mod yet, and before installing it to my main forum, I'll install it to my test forum first to test everything out, and make sure that I can do this on my own :D  Should I run into any problems I'll be sure to ask ;)  I'll hopefully get to do that before the week is out.

I see that there are tons of things that people want for the pet mod, but honestly I'm just happy that you have gotten it up and running :D  I can wait for everything else, I feel like this, I'd rather you fix what's wrong or could be wrong with the coding before jumping off into something else for it....and let me tell you it's MUCH appreciated :D

Again THANK YOU THANK YOU THANK YOU!!!!
Title: Re: SMFPets is Finally Here
Post by: TechnoDragon on March 14, 2007, 02:03:18 pm
I guess you want to say thank you...

so...YOU'RE WELCOME!

ROFL
Title: Re: SMFPets is Finally Here
Post by: xfollowthereaperx on March 15, 2007, 11:51:37 am

No problems here. My default skin is renamed and everything and I now use the WoW Theme by StormLrd.
And I can view the pets.

Maybe xfollowthereaperx can post a screenshot of a user profile?
I could but I'm not sure how that would help :p

Maybe someone can just post the code I need to edit into display.template.php
Title: Re: SMFPets is Finally Here
Post by: Basil Beard on March 16, 2007, 05:22:49 am
SMFPets 0.1 now works(I think)

please visit:

http://dev.dansoftaustralia.net/frs/?group_id=10

to download
Title: Re: SMFPets is Finally Here
Post by: Lady Ambrosia on March 16, 2007, 05:55:21 am
So far so good, I've not had any problems with images or creating new pets or skills in my test forum.  Everything seems to be working WONDERFULLY, you did an AWESOME job on this one Basil Beard!!  And TechnoDragon, I'm having a blast with the few codes that you've made as well.

My only question/request I can think of, is there away to make the pet viewable in the display profile of a post?  I'm not sure how to edit that one.  I only tweak php here and there but to do anything more complex is beyond my skills.  Thanks!

Again AWESOME little addon to the Shop I LOVE IT!!!


EDIT:  I just installed the little update to the pets mod, and so far it's working wonderfully, I like it VERY MUCH!!  Awesome work!!  I can't wait to what else you have in store :D
Title: Re: SMFPets is Finally Here
Post by: Aruta on March 16, 2007, 06:48:29 pm
SMFPets 0.1 now works(I think)

please visit:

http://dev.dansoftaustralia.net/frs/?group_id=10

to download

w00t! thanx man  O0
installing as we speak..

edit: whoops, im getting install errors:

1.     Execute Code     updateScript.php     
2.    Execute Modification    ./Sources/shop/pet_engine.php    Test failed
3.    Execute Modification    ./Themes/default/languages/Shop.english.php    Test successful
4.    Execute Modification    ./Sources/shop/Shop-Subs.php    Test successful
5.    Extract File    ./Sources/shop/items/Food.php

Might be due to the modifications I made to show the pics? Is it ok to install anyway? Ill wait untill I hear something.
Been testing this in a live forum.  ::)
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: GhostWriter on March 16, 2007, 09:28:07 pm
I uploaded this MOD through package manager andwhen I go to install this is the error I get..

Execute Modification ./Sources/shop/pet_engine.php File not found

I think it is an easy error, but I am not that great with coding and am not sure how to fix it.....
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on March 16, 2007, 10:30:55 pm
Yeah. The install will probably only work if you are using a fresh version of SMF Pets 0-0. Sorry.

And GhostWriter. Did you install SMFPets 0-0 before installing the upgrade?
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: GhostWriter on March 16, 2007, 11:16:32 pm
No.....

Guess I should go and do that one now shouldn't I?

Thanks Basil...

***EDIT***
Alright now I feel like an idiot, I just installed smfpets0.0 and then the upgrade and it works great. Now I may have missed something through out this thread, which knowing me and how tired I am right now I most likely did. But what I want to know is where do you add new pets and these skills that everyone is posting? What file exactly?

Sorry if I reposted something that has already been answered....
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on March 16, 2007, 11:43:26 pm
Pets are adding by uploading breed files to the pets_breeds dirc located in the shop dirc. Skills are included in said files.
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: GhostWriter on March 16, 2007, 11:48:31 pm
Everytime I try to upload a file into the breed directory, I get a an error telling me that the fiel could not be uploaded...

Quote
move /home/ghostte/tmp/cpanel.TMP.7BUrZsxEcWppvgLU, /home/ghostte/public_html/Sources/shop/pet_images/blank1.gif failed: Permission denied
C:\Documents and Settings/owner/\My Documents\blank1.gif (blank1.gif): upload failed
.

Thats the error message...I tried to upload something just inside the shop and it worked, the same with uploaded the same gif into the root and it went through...

Also when I try to create a new file for a new pet I get this error
Quote
[a fatal error or timeout occurred while processing this directive]

I know I have all the access permissions since I am the only one allowed into the cpanel, so I am not sure what could be causing this problem..

Also what I meant about the skills, was the skills that everyone is placing up, where would they be placed..Sorry if I sound stupid about the subject, but my PHP skills are like -10..I am learning though..... :'(

Once again, I am sorry for being such a pain!!
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: inkstains on March 17, 2007, 11:07:34 am
Everytime I try to upload a file into the breed directory, I get a an error telling me that the fiel could not be uploaded...

Quote
move /home/ghostte/tmp/cpanel.TMP.7BUrZsxEcWppvgLU, /home/ghostte/public_html/Sources/shop/pet_images/blank1.gif failed: Permission denied
C:\Documents and Settings/owner/\My Documents\blank1.gif (blank1.gif): upload failed
.

Thats the error message...I tried to upload something just inside the shop and it worked, the same with uploaded the same gif into the root and it went through...

Also when I try to create a new file for a new pet I get this error
Quote
[a fatal error or timeout occurred while processing this directive]

I know I have all the access permissions since I am the only one allowed into the cpanel, so I am not sure what could be causing this problem..

Also what I meant about the skills, was the skills that everyone is placing up, where would they be placed..Sorry if I sound stupid about the subject, but my PHP skills are like -10..I am learning though..... :'(

Once again, I am sorry for being such a pain!!

don't quote me because i am still learing myself

your first problem could be the permissions on the actual pet_images folder in your file manager on cpanel you can click the folder name then go edit permissions and change it from there (but i'd wait till one of the other guys responds on that one)

as for skills they go into pet_breeds folder i'm fair sure the package comes with a blank that you can edit and it's fairly self explanatory though the addition of extra skills is probably something you need a little bit more knowledge about php etc but i imagine people with more experience will post more as they develop them, Basil Beard already posted one up earlier in this thread.

Title: Re: SMFPets is Finally Here (0.1 out)
Post by: inkstains on March 17, 2007, 12:13:43 pm
EDIT: TechnoDragon has kindly added to this to make it show/not show depending on pet ownership i'd recommend you use that instead just scroll down for the post


Not sure if anyone else will want to do this but thought i'd throw it up

to add a link to a members profile pets section as shown in the image below

(http://img150.imageshack.us/img150/9426/petsimagerk1.gif)


locate Display.template.php

search for

Code: [Select]
// Don't show the profile button if you're not allowed to view the profile.
if ($message['member']['can_view_profile'])
echo '
<a href="', $message['member']['href'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/icons/profile_sm.gif" alt="' . $txt[27] . '" title="' . $txt[27] . '" border="0" />' : $txt[27]), '</a>';


and directly below add this

Code: [Select]
if ($message['member']['can_view_profile'])
echo '
<a href="', $message['member']['href'], ';sa=showPets">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/icons/pets.gif" alt="' . $txt[27] . '" title="' . $txt[27] . '" border="0" />' : $txt[27]), '</a>';



i've attached the image i used for the icon but you can replace it with whatever you want just upload it to the default themse images/icons folder and change the name in the code to correspond to your image name

hope this is of help i know it could have saved me a little time





Title: Re: SMFPets is Finally Here (0.1 out)
Post by: TechnoDragon on March 17, 2007, 12:17:11 pm
thats actually a very good idea...now if I can only figure out a way to only have it show if they actually have pets...
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: inkstains on March 17, 2007, 12:26:24 pm
I don't see why you couldn't do that you'd just need to add a check_pets query or something I'm still novice so I'll have a look but i'm not sure how it would work but yeh i'll have a go unless someone else can offer the answer.
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: TechnoDragon on March 17, 2007, 12:27:21 pm
working on the code right now...give me about 10 minutes! ok, maybe 30 LOL
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: TechnoDragon on March 17, 2007, 01:15:25 pm
OK, here's the skinny:

in Load.php find:
Code: [Select]
$row['options'] = array();
$user_profile[$row['ID_MEMBER']] = $row;
}
mysql_free_result($request);
add below that:
Code: [Select]
//Load the pet data
$request2 = db_query("
SELECT COUNT(*) AS pets, ownerid
FROM {$db_prefix}shop_pets
WHERE ownerid IN ('" . implode("', '", $loaded_ids) . "')
GROUP BY ownerid", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request2))
$user_profile[$row['ownerid']]['pets'] = $row['pets'];
mysql_free_result($request2);

then find:
Code: [Select]
'post_group' => $profile['post_group'],
add below:
Code: [Select]
//another pets modification
'pets' => &$profile['pets'],

then in the display template.php find the code you suggested and add this below instead:
Code: [Select]
//finally a pets button
if ($message['member']['can_view_profile']){
if($message['member']['pets'] > 0){
echo '
<a href="', $message['member']['href'], ';sa=showPets">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/icons/pets.gif" alt="' . $txt[27] . '" title="' . $txt[27] . '" border="0" />' : $txt[27]), '</a>';
}
}

this will only show the link to the members pets in profile on two conditions:
     1. person can view profiles
     2. member actually has a pet

there you go...ENJOY!
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: inkstains on March 17, 2007, 01:39:37 pm
beauty nice stuff TechnoDragon that's a lot cleaner


heres a skill i just finished it's fairly basic but might save someone else the hassle of doing it

it's a modification on the skill Basil Beard posted earlier and the increase karma item

Code: [Select]
<?php
if (!class_exists(pet_Test_pet)) { //Make sure name matches php file
class pet_Test_pet extends petTemplate //Make sure name matches php file
function load_breed() {
$this->breed 'Test - Eastern Cottontail'//The name of the breed(Use _ instead of whitespace or else Baby Jesus will cry)
$this->breed_desc 'Enter Description'//The description of the breed.
    
$this->price 10//The price to purchase one of these pets
    
$this->breed_img 'image.gif'//The img file of the breed
    
$this->skills_cnt 1//The number of skills the pet can use

    //Sample skill. For each addtional skill, increase the index by one.(So your next skill would be $this->skill[1])
$this->skill[0] = new skill;       //Required for making new skills. 
$this->skill[0]->name "Skill Name";   //Name of skill
$this->skill[0]->level_learn 1;  //Level the pet learns the skill
$this->skill[0]->level_max 2;    //Level the pet masters the skill
$this->skill[0]->cost 1;         //Cost, in skill points, of the skill.
}

//This will increase the members good karma by a random value between 1 and 10
        
function use_skill_0() {
global $db_prefix$ID_MEMBER;
$value mt_rand(1,10);
$result db_query("UPDATE {$db_prefix}members SET karmaGood = karmaGood + {$value} WHERE ID_MEMBER = {$ID_MEMBER}"__FILE____LINE__);
return "{$this->name} successfully increased your Karma by ".($value)." for you";
        }

}
}
?>
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: inkstains on March 17, 2007, 02:08:18 pm
one more skill to increase total time logged in

Code: [Select]
<?php
if (!class_exists(pet_Test2_pet)) { //Make sure name matches php file
class pet_Test2_pet extends petTemplate //Make sure name matches php file
function load_breed() {
$this->breed 'Test2 - Eastern Cottontail'//The name of the breed(Use _ instead of whitespace or else Baby Jesus will cry)
$this->breed_desc 'Enter Description'//The description of the breed.
    
$this->price 10//The price to purchase one of these pets
    
$this->breed_img 'image.gif'//The img file of the breed
    
$this->skills_cnt 1//The number of skills the pet can use

    //Sample skill. For each addtional skill, increase the index by one.(So your next skill would be $this->skill[1])
$this->skill[0] = new skill;       //Required for making new skills. 
$this->skill[0]->name "Skill Name";   //Name of skill
$this->skill[0]->level_learn 1;  //Level the pet learns the skill
$this->skill[0]->level_max 2;    //Level the pet masters the skill
$this->skill[0]->cost 1;         //Cost, in skill points, of the skill.
}

//just edit the random number values to change the amount of time to increase by
        
function use_skill_0() {
global $db_prefix$ID_MEMBER;
$value mt_rand(13200,43200);
$result db_query("UPDATE {$db_prefix}members SET totalTimeLoggedIn = totalTimeLoggedIn + {$value} WHERE ID_MEMBER = {$ID_MEMBER}"__FILE____LINE__);
return "{$this->name} successfully increased your Total Time Logged In by ".($value)." seconds for you";
}

}
}
?>

it'd be good to be able to present the increased amount in days hours minutes seconds instead of just a string of seconds anyone know how to do that? i'm still a php baby
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: inkstains on March 17, 2007, 02:29:22 pm
Sorry to post so many just figure if it saves someone time, though there not exactly complicated to do.

anyways heres the last one i'll post it'll increase the members post count at a value between 1 and 50 or whatever you chose to set it to

Code: [Select]
<?php
if (!class_exists(pet_Test3_pet)) { //Make sure name matches php file
class pet_Test3_pet extends petTemplate //Make sure name matches php file
function load_breed() {
$this->breed 'Test3 - Eastern Cottontail'//The name of the breed(Use _ instead of whitespace or else Baby Jesus will cry)
$this->breed_desc 'Enter Description'//The description of the breed.
    
$this->price 10//The price to purchase one of these pets
    
$this->breed_img 'image.gif'//The img file of the breed
    
$this->skills_cnt 1//The number of skills the pet can use

    //Sample skill. For each addtional skill, increase the index by one.(So your next skill would be $this->skill[1])
$this->skill[0] = new skill;       //Required for making new skills. 
$this->skill[0]->name "Skill Name";   //Name of skill
$this->skill[0]->level_learn 1;  //Level the pet learns the skill
$this->skill[0]->level_max 2;    //Level the pet masters the skill
$this->skill[0]->cost 1;         //Cost, in skill points, of the skill.
}

//just change the random values to alter the amount of posts the member can get
        
function use_skill_0() {
global $db_prefix$ID_MEMBER;
$value mt_rand(1,50);
$result db_query("UPDATE {$db_prefix}members SET posts = posts + {$value} WHERE ID_MEMBER = {$ID_MEMBER}"__FILE____LINE__);
return "{$this->name} successfully increased your Post Count by ".($value)." for you";
}

}
}
?>
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on March 18, 2007, 01:03:01 am
Actually Technodragon, it would probably be even cleaner to just load the numpets (I think thats what I called it) from the members database. But thats still some very nice code there. I'll probably include it in v 0.2 =)
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: TechnoDragon on March 18, 2007, 01:23:30 am
ROFL

I didn't realize about the numpets, I could change that around if you like?  Thank you...I am always trying to figure out small ways to improve everything i use or help others do the same!

as an update...The combat portion has not been forgotten, we are just trying to finalize the current beta version of my mod before we proceed on any new features(we found that we are getting into an infinite loop where we finish, figure out something new, then keep coding.  We HAD to pick a point to stop otherwise we would never release it! ROFL)
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Lady Ambrosia on March 18, 2007, 01:54:33 am
I'm just being patient about the combat part of the mod, as I'm only using the mod on my test forum, I want to create pets and skills before allowing my members to play around (aren't I mean?).  Plus get myself more familiar with the mod (I always like doing that just incase something goes crazy on my part, and it usually does).

I do have a small suggestion, although it's not needed right at this minute ;)  What about making categories for the pets, for example:
Quote
Dragons
Then have different types and colors of dragons listed under this category

Cats
Then have different types of cats (from house cat to wild cats) and colors under this category

Just an idea for later versions of the Pet Shop.  OH and I found more animal icons that people can use for their little pets:
http://www.iconarchive.com/  (don't freak they have gif files you can use too)
http://www.clipart.co.uk/index.shtml

Maybe those will help some one who needs images for pets :D
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: GhostWriter on March 18, 2007, 05:35:19 am


don't quote me because i am still learing myself

your first problem could be the permissions on the actual pet_images folder in your file manager on cpanel you can click the folder name then go edit permissions and change it from there (but i'd wait till one of the other guys responds on that one)

as for skills they go into pet_breeds folder i'm fair sure the package comes with a blank that you can edit and it's fairly self explanatory though the addition of extra skills is probably something you need a little bit more knowledge about php etc but i imagine people with more experience will post more as they develop them, Basil Beard already posted one up earlier in this thread.



I tried what you said inkstains and still the same thing happens and all the permissions are set at the highest level they can be...I don't know what else it could be...Gues I should just ask, Basil Beard, since it's your project do you know what could be causing the errors I am getting when I try and upload an image into the pet_image directory and when I try to create a new file?
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: majestic on March 18, 2007, 02:52:27 pm
I've looked through this thread..but I haven't found the answer, so maybe I'm blind. How do you get rid of your pet? What if you don't want it anymore? Is there a place to delete? or to go to the exact file of that person's pet and delete it?...thanks
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: TechnoDragon on March 18, 2007, 03:35:21 pm
Currently the only way to remove a members pet in directly through the database...
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on March 18, 2007, 10:33:53 pm
A few other people have had problem with dirc. permissions. I dunno what causes them. A few ideas:

*Delete the old directories and then create the need directories manually.
If that doesnit work: Have the old directories pre-created and then re-install the mod.
If all else fails, install the mod by hand <_<
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: GhostWriter on March 19, 2007, 01:55:07 am
Quote
Uninstall Actions
Uninstall Actions "SMFPets":
Installing this package will perform the following actions:  Type Action Description
1. Execute Modification ./Sources/ManagePermissions.php Test successful
2. Execute Modification ./Themes/default/Profile.template.php Test successful
3. Execute Modification ./Themes/default/languages/ManagePermissions.english.php Test successful
4. Execute Modification ./Themes/default/languages/Shop.english.php Test failed
5. Execute Modification ./Themes/default/Shop.template.php Test successful
6. Execute Modification ./Sources/shop/Shop.php Test successful
7. Execute Modification ./Sources/shop/Shop-Subs.php Test failed
8. Execute Modification ./Sources/Profile.php Test successful
9. Execute Code uninstallScript.php 
10. Delete Tree pets_breeds 
11. Delete Tree pet_images 
12. Delete File Shop-Pets.php 
13. Delete File pet_engine.php 
14. Delete File Cage.php 
15. Delete File Food.php
 

Thats the error I get when trying to uninstall the 0.0 mod....
I can't even delete the files manually.......Thpough all ans all this is an awesome mod an d I really want to get it working right......
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: inkstains on March 19, 2007, 02:15:39 am
if you uninstall you can manually remove those entries from the ones that failed

in Shop.english.php you would need to remove this

Code: [Select]
//Text strings for pets
$txt['pets_adpot'] = 'You have adpoted a new %s... yay!';
$txt['pets_age'] = 'Age: ';
$txt['pets_breed'] = 'Breed: ';
$txt['pets_buy'] = 'Buy a %s!';
$txt['pets_central'] = 'Pet Central';
$txt['pets_cost'] = 'Cost: ';
$txt['pets_course_finish'] = 'Your pet has completed its course! It is now level %s!';
$txt['pets_course_taking'] = 'Your pet is still taking its course. Check back at %s.';
$txt['pets_days'] = '%s days.';
$txt['pets_describe'] = 'Describe your pet';
$txt['pets_description'] = 'Description ';
$txt['pets_do_stuff'] = 'Do stuff with your pet (Current Skill Points: ';
$txt['pets_find_name'] = 'Name for your new pet';
$txt['pets_happy'] = 'Happiness: ';
$txt['pets_hatchery'] = 'Pet Hatchery';
$txt['pets_hunger'] = 'Lack of Hunger: ';
$txt['pets_level'] = 'Level: ';
$txt['pets_name'] = 'Name: ';
$txt['pets_new_desc'] = 'Your pets description is now %s.';
$txt['pets_new_name'] = 'Your pet is now called %s.';
$txt['pets_no_pet'] = 'You do not have a pet right now. Head over to the <a href=%s?action=shop;do=hatchery>Hatchery</a> and adopt a pet!';
$txt['pets_no_train_money'] = 'You do not have enough money to train your pet!';
$txt['pets_not_yours'] = 'Nice try, wise guy, but that is not your pet!';
$txt['pets_place_course'] = 'You have placed your pet in the course. Check back at %s.';
$txt['pets_rename'] = 'Rename your pet';
$txt['pets_return_link'] = 'Click <a href=%s?action=shop;do=pets>here</a> to return to the pet menu';
$txt['pets_skill_fail'] = 'Try and it might, your pet fails to accomplish its skill. Try raising its level.';
$txt['pets_skill_happy'] = 'Your pet sits around doing nothing. Maybe your should cheer it up';
$txt['pets_skill_hunger'] = 'Your pet is too hungry to use that skill.';
$txt['pets_skill_no_power'] = 'You do not have enough power to use that skill.';
$txt['pets_talk_too_much'] = 'That pet costs too much!!!';
$txt['pets_too_many'] = 'You are not allowed any more pets!!!';
$txt['pets_train_pet'] = 'Level it up!';
$txt['pets_train'] = 'Train your pet';
$txt['pets_train_cost'] = 'Current training cost: ';
$txt['pets_use_skill'] = 'Use Skill';
$txt['pets_your_pets'] = 'Your pets';
$txt['pets_yourpet'] = 'Pet Central';
$txt['profile_show_pets'] = 'Show this member\'s pets';
$txt['profile_show_pets2'] = 'Member\'s Pets:';
$txt['shop_pet_page'] = 'Pet Central';

and in Shop-Subs.php remove this code

Code: [Select]
function check_Pets() {
global $db_prefix, $sourcedir, $modSettings;
$date = date('z');
if ($modSettings['shop_pets_date'] != $date) {
require($sourcedir . '/shop/pet_engine.php');
if ($handle = opendir($sourcedir . "/shop/pets_breeds/")) {
while (false !== ($file = readdir($handle))) {
if (substr($file, -4) == '.php')
{
// Get the breed name (file name without .php extension)
require($sourcedir . '/shop/pets_breeds/' . $file);
}
}
}
$result = db_query("SELECT * FROM {$db_prefix}shop_pets", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($result)) {
eval('$temp = new pet_' . $row['breed'] . ';');
$temp->load_values($row['pet_id']);
$temp->advance_day();
$temp->store_values();
}
$result = db_query("UPDATE {$db_prefix}settings SET value = {$date} WHERE variable = 'shop_pets_date'", __FILE__, __LINE__);
}
}

thats if you feel confident to edit the files just make backups of them before you do so you can quickly recover if something goes awry


EDIT: Removing the above bits of code might not even be necessary but if it were me i would do it just in case
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on March 19, 2007, 02:46:29 am
the package uninstalls fine for me. Did you apply any other changes to the code? o_0
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: GhostWriter on March 19, 2007, 04:39:14 am
No other changes at all..Just installed them as you said and tried to add pets to them and couldn't upload anything, delete anything and then tried to uninstall and got that error. So I will try to uninstall and then manually uninstall the rest and maybe try a new install and if that don't work, I will manually install it to see if it works any better.
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on March 19, 2007, 05:36:13 am
yeah. Sorry. I donno why it isn't uninstalling. =(
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: TechnoDragon on March 19, 2007, 04:46:27 pm
for the issues with the directory permissions...I have been having similar issues with a mod I have been working on with some sites and the issue has been traced to the smf package manager chown when installing packages.  For some reason (haven't been able to trace the cause yet) it changes the owner of the directories which makes them effectively unusable for he forum.
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: inkstains on March 19, 2007, 05:06:54 pm
This is an item i did up it's based on Basil Beards food item but it increases the maxap of the pet at a random amount which you set when doing the item setup. hope it's useful for someone

I've included the icon i use for this item i called it power up so this image just seemed appropriate but you can use whatever it's got a transparent background as well so you won't have a white background or anything on a different theme

to use this just save it and upload to item_images folder and select it when you set up the item

(http://img264.imageshack.us/img264/1919/powerupcj2.gif)


EDIT: I'm only a beginner with php I've tested this as best i can and have run into no problems but if you spot a error or something post it up please not just to fix but so i can learn. cheers.


Make sure to save this file as PowerUp.php
Code: [Select]
<?php
/**********************************************************************************
* SMFShop item                                                                    *
***********************************************************************************
* SMFShop: Shop MOD for Simple Machines Forum                                     *
* =============================================================================== *
* Software Version:           SMFShop 3.0 (Build 12)                              *
* $Date:: 2007-01-18 19:26:55 +1100 (Thu, 18 Jan 2007)                          $ *
* $Id:: Steal.php 79 2007-01-18 08:26:55Z daniel15                              $ *
* Software by:                DanSoft Australia (http://www.dansoftaustralia.net/)*
* Copyright 2005-2007 by:     DanSoft Australia (http://www.dansoftaustralia.net/)*
* Support, News, Updates at:  http://www.dansoftaustralia.net/                    *
*                                                                                 *
* Forum software by:          Simple Machines (http://www.simplemachines.org)     *
* Copyright 2006-2007 by:     Simple Machines LLC (http://www.simplemachines.org) *
*           2001-2006 by:     Lewis Media (http://www.lewismedia.com)             *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under   *
* the terms of the provided license as published by Simple Machines LLC.          *
*                                                                                 *
* This program is distributed in the hope that it is and will be useful, but      *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY    *
* or FITNESS FOR A PARTICULAR PURPOSE.                                            *
*                                                                                 *
* See the "license.txt" file for details of the Simple Machines license.          *
* The latest version of the license can always be found at                        *
* http://www.simplemachines.org.                                                  *
**********************************************************************************/

if (!defined('SMF'))
die('Hacking attempt...');

class 
item_PowerUp extends itemTemplate
{
function getItemDetails()
{
$this->authorName 'Inkstains - Modified from Basil Beard Food Item';
$this->authorWeb 'www.nomicville.com';
$this->authorEmail 'basilbeard@nomicville.com';

$this->name 'Power Up';
$this->desc 'Power Up for your pet!';
$this->price 400;

$this->require_input true;
$this->can_use_item true;
}

function getAddInput()
{
global $item_info$db_prefix;
return 'Minimum amount to increase maxap by: <input type="text" name="info1" value="' $item_info[1]  . '" /><br />
                        Maximum amount to increase maxap by: <input type="text" name="info2" value="' 
$item_info[2] . '" /><br />';
        }

function getUseInput()
{
global $db_prefix$ID_MEMBER;
                
$result db_query("SELECT numpets FROM {$db_prefix}members WHERE ID_MEMBER = {$ID_MEMBER}"__FILE____LINE__);
$row mysql_fetch_assoc($result);
if ($row['numpets'] == 0) {
return "You have no pets. Using this item will simply cause it to die and you to lose money.";
}
$string .= "<select name = 'petid'>";
$result db_query("SELECT * FROM {$db_prefix}shop_pets WHERE ownerid = {$ID_MEMBER}"__FILE____LINE__);
while ($row mysql_fetch_assoc($result)) {
$string .= "<option value = '{$row['pet_id']}'>{$row['name']}</option>";
}
$string .= "</select>";
return "Select a pet to give this item to: ".$string;
}

function onUse()
{
global $db_prefix$ID_MEMBER$item_info;

if (!isset($_POST['petid'])) {
return "I told you it would die!";
}
else {
$value mt_rand($item_info[1], $item_info[2]);
                        
$result db_query("UPDATE {$db_prefix}shop_pets SET maxap = maxap + {$value} WHERE pet_id = {$_POST['petid']} AND ownerid = {$ID_MEMBER}"__FILE____LINE__);
$result db_query("SELECT * from {$db_prefix}shop_pets WHERE pet_id = {$_POST['petid']} AND ownerid = {$ID_MEMBER}"__FILE____LINE__);
$row mysql_fetch_assoc($result);
return "{$row['name']} eats the mushroom its maxap is now {$row['maxap']}!";

}
}
}
?>

Title: Re: SMFPets is Finally Here (0.1 out)
Post by: GhostWriter on March 20, 2007, 06:02:34 am
Alright, I finally got it to uninstall without any problems. As I said before I would really like to use this mod, since a few of my members are interested in the pets and they seem to want to post more. So any suggestions on how I could get it installed and not have to worry about the permissions thing?

How would I manually install it?
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Alexander on March 20, 2007, 06:25:32 am
Okay, you guys are having problem deleting the folders right (I'm a bit lost)?

I have this mod installed on my forums, I've had the same problem too. I just backed up the folder's contents then deleted the folder, made a new one through my ftp (and is deletable). It's able to chmod/delete when my FTP isn't.
http://custom.simplemachines.org/mods/index.php?mod=477
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: tamibrown on March 20, 2007, 06:35:17 am
**NEVERMIND, FIGURED IT OUT**

Ok, mod installed fine.  Put a test pet up to try out.  I can buy it and everything is fine.  I named my file goldfish.php.  Evenryting is fine until I go into Pet Central.  Then I get this error:

Quote
Fatal error: Cannot redeclare class pet_goldfish in /home/content/a/t/w/atwfd07/html/smf/Sources/shop/pets_breeds/goldfish.php on line 3

What am I doing wrong?  Here is the code in my file (and yes,  I know I havent changed breed name or description or anything....this is a test one):

Code: [Select]
<?php
if (!class_exists(pet_goldfish.php)) { //Make sure name matches php file
class pet_goldfish extends petTemplate //Make sure name matches php file
function load_breed() {
$this->breed 'Breed Name'//The name of the breed(Use _ instead of whitespace or else Baby Jesus will cry)
$this->breed_desc 'Breed descrption'//The description of the breed.
    
$this->price 1//The price to purchase one of these pets
    
$this->breed_img 'goldfish.gif'//The img file of the breed
    
$this->skills_cnt 1//The number of skills the pet can use
        
    //Sample skill. For each addtional skill, increase the index by one.(So your next skill would be $this->skill[1])
$this->skill[0] = new skill;       //Required for making new skills. 
$this->skill[0]->name "Skill";   //Name of skill
$this->skill[0]->level_learn 1;  //Level the pet learns the skill
$this->skill[0]->level_max 2;    //Level the pet masters the skill
$this->skill[0]->cost 1;         //Cost, in skill points, of the skill.
}

//Sample skill function. A different function is needed for each skill. Skill function should be named "use_skill_i" where i is that skills index.
//Code these skills like you would code the action part of items. Currently input cannot be given into skills. Sorry.
function use_skill_0() {
global $db_prefix$ID_MEMBER;
return "{$this->name} has used it's skill!";
}
}
}
?>
[/s]
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Lady Ambrosia on March 20, 2007, 08:57:25 am
Shop Starter Pets!!  This zip file has a few pet images and breeds (Bird, Cat, Dog, Fish, Lizard, and Monkey) and they all have one skill.  You are more than welcome to change the breed name, description, and how much they are, this is just to get you all started so run with it!! ;)

You can download the zip file here:  http://www.4shared.com/file/12563346/48be8657/Starter_Pets.html

You can view what I've done on my test forum here:  http://chatho4.100webspace.net/index.php
Login:  Test
Password:  Test



If you need help with image sizes so that the images show up with their actual size here's what you need to do:

In Sources/shop/pet_engine.php find the following (you will find this twice and you need to replace both):
Code: [Select]
<img border='0' width='120' height='120' src='".$boardurl."/Sources/shop/pet_images/".$this->breed_img."' alt='".$this->breed."' />
Replace it with:
Code: [Select]
<img border='0' src='".$sourcedir."/shop/pet_images/".$this->breed_img."' alt='".$this->breed."' />

Then in Sources/shop/Shop-Pets.php find the following (you will only find this once):
Code: [Select]
<img border='0' width='120' height='120' src='".$boardurl."/Sources/shop/pet_images/".$pet->breed_img."' alt='".$pet->breed."' />
Replace it with:
Code: [Select]
<img border='0' src='".$boardurl."/Sources/shop/pet_images/".$pet->breed_img."' alt='".$pet->breed."' />

Enjoy!!!
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on March 20, 2007, 11:37:33 am
Very nice =). Starter pets are something I'll eventually have, but just never bothered to include yet =P
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Lady Ambrosia on March 20, 2007, 03:19:11 pm
You're more than welcome to use these for later versions if you want Basil Beard ;)
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: tamibrown on March 23, 2007, 09:03:27 am
How does a pet earn more skill points after they use them?

Title: Re: SMFPets is Finally Here (0.1 out)
Post by: inkstains on March 23, 2007, 10:24:47 am
by feeding them and it gets reset/topped up every 24hrs or something like that i believe
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: littleone on March 24, 2007, 01:54:01 pm
is it normal for the use skill area to disappear?
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: littleone on March 25, 2007, 07:48:50 am
I am not one Level 3 as the picture shows, and I still dont have a Skills button for either of my pets and I dont understand why.  I had it when I first purchased my pet, i went to use it and it gave me a message saying it wasnt ready for it, so I went to train it.  I then purchased another pet, and it didnt come with a skill button at all.  The both look the same as my screenshot shows in the Use skills area.

(http://img259.imageshack.us/img259/5505/1awj2.th.jpg) (http://img259.imageshack.us/my.php?image=1awj2.jpg)
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: inkstains on March 25, 2007, 09:46:04 am
is it just that pet or all of them? i'd check your pets php file and make sure everything is right and the skill cnt is correct
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: littleone on March 25, 2007, 10:02:18 am
Here is an example code.  This is actually the code of the pets i have shown in my Screenshot.  I own 2 pets and both pets look the same.

Code: [Select]
<?php
if (!class_exists('pet_Terrier_pet')) { //Make sure name matches php file
class pet_Terrier_pet extends petTemplate //Make sure name matches php file
function load_breed() {
$this->breed 'Terrier Dog'//The name of the breed(Use _ instead of whitespace or else Baby Jesus will cry)
$this->breed_desc 'This is a Terrier Dog'//The description of the breed.
    
$this->price 5000//The price to purchase one of these pets
    
$this->breed_img 'terrier.jpg'//The img file of the breed
    
$this->skills_cnt 4//The number of skills the pet can use
        
    //Sample skill. For each addtional skill, increase the index by one.(So your next skill would be $this->skill[1])
$this->skill[0] = new skill;       //Required for making new skills. 
$this->skill[0]->name "Bark";   //Name of skill
$this->skill[0]->level_learn 1;  //Level the pet learns the skill
$this->skill[0]->level_max 3;    //Level the pet masters the skill
$this->skill[0]->cost 1;         //Cost, in skill points, of the skill.
$this->skill[1] = new skill;
$this->skill[1]->name "Learn to Sit";
$this->skill[1]->level_learn 2;
$this->skill[1]->level_max 4;
$this->skill[1]->cost 3;
$this->skill[2] = new skill;
$this->skill[2]->name "Learn to Rollover";
$this->skill[2]->level_learn 5;
$this->skill[2]->level_max 10;
$this->skill[2]->cost 8;
$this->skill[3] = new skill;
$this->skill[3]->name "Westminster Quality";
$this->skill[3]->level_learn 10;
$this->skill[3]->level_max 20;
$this->skill[3]->cost 20;
}

//Sample skill function. A different function is needed for each skill. Skill function should be named "use_skill_i" where i is that skills index.
//Code these skills like you would code the action part of items. Currently input cannot be given into skills. Sorry.
function use_skill_0() {
global $db_prefix$ID_MEMBER;
return "{$this->name} has learned to Bark on Command!";
}
function use_skill_1() {
global $db_prefix$ID_MEMBER;
$value mt_rand(30,600);
$result db_query("UPDATE {$db_prefix}members SET money = money + {$value} WHERE ID_MEMBER = {$ID_MEMBER}"__FILE____LINE__);
return "{$this->name} has learned to sit and earned you ".formatMoney($value)." tokens!";
        }
        function 
use_skill_2() {
global $db_prefix$ID_MEMBER;
$value mt_rand(80,1600);
$result db_query("UPDATE {$db_prefix}members SET money = money + {$value} WHERE ID_MEMBER = {$ID_MEMBER}"__FILE____LINE__);
return "{$this->name} has learned to rollover and earned you ".formatMoney($value)." tokens!";
}
function use_skill_3() {
global $db_prefix$ID_MEMBER;
$value mt_rand(200,4000);
$result db_query("UPDATE {$db_prefix}members SET money = money + {$value} WHERE ID_MEMBER = {$ID_MEMBER}"__FILE____LINE__);
return "{$this->name} place in a Westminster Dog Show and earned you ".formatMoney($value)." tokens!";
}
}
}
?>
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: inkstains on March 25, 2007, 10:19:21 am
your pet looks fine

i'd check whatever other modifications to code you might have made in pet_engine.php or anywhere else but i'd start there otherwise wait till feeble or Basil Beard see this they'll know what's happening
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: littleone on March 25, 2007, 12:35:27 pm
For some reason I cant attach files so i have to post my whole code.  Here is the pet_engine file:

Code: [Select]
<?php
/**********************************************************************************
* pet_engine.php&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; *
* Backend engnie for pets&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;  *
***********************************************************************************
* SMFPets: Pets MOD for Daniel15's Shop Mod for Simple Machines Forum&#160; &#160; &#160; &#160; &#160; &#160;  *
* =============================================================================== *
* Software Version:&#160; &#160; &#160; &#160; &#160;  SMFPets 1.0 (Build 1)&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;  *
* $Date:: 2007-02-10 8:33 PM EST (Sat, 10 Feb 2007)&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;  $ *
* $Id:: pet_engine.php 79 2007-01-18 08:26:55Z basilbeard&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;  $ *
* Software by:&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; Basilbeard&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; *
* Copyright&#160; &#160; &#160; 2007 by:&#160; &#160;  Basilbeard&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; *
* Support, News, Updates at:&#160; http://www.daniel15.com/forum&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;  *
*&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;  *
* Forum software by:&#160; &#160; &#160; &#160; &#160; Simple Machines (http://www.simplemachines.org)&#160; &#160;  *
* Copyright 2006-2007 by:&#160; &#160;  Simple Machines LLC (http://www.simplemachines.org) *
*&#160; &#160; &#160; &#160; &#160;  2001-2006 by:&#160; &#160;  Lewis Media (http://www.lewismedia.com)&#160; &#160; &#160; &#160; &#160; &#160;  *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under&#160;  *
* the terms of the provided license as published by Simple Machines LLC.&#160; &#160; &#160; &#160; &#160; *
*&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;  *
* This program is distributed in the hope that it is and will be useful, but&#160; &#160; &#160; *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY&#160; &#160; *
* or FITNESS FOR A PARTICULAR PURPOSE.&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; *
*&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;  *
* See the "license.txt" file for details of the Simple Machines license.&#160; &#160; &#160; &#160; &#160; *
* The latest version of the license can always be found at&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; *
* http://www.simplemachines.org.&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; *
**********************************************************************************/

// Basically, this is a basic pet. All the defaults are defined here.
// So, if anything isn't defined by the pet, the defaults are inherited from here
if (!class_exists('petTemplate')) {
class 
petTemplate
{
/* 
 * All the below fields aren't in the breed files themselves. They're just defaults
 * The correct values are filled in with other functions.
 * These values are used as fallovers. If any of the variables aren't defined in the item,
 * it will use the defaults from here.
 */
//These vars depend on the pet and are set by the owner of the pet.
var $name 'No Name'; // The name of the pet
var $desc 'No Desc'//The description the user has given.
var $level 0//The level of the pet;
var $curap 0//The current number of skill points the pet has
var $maxap 0//The max number of skill points the pet has
var $age 0//How old(in days) the pet is
var $happy 0//Pets Happiness
var $hunger 0//Pets Hunger
var $id 0//Pet ID
var $training 0//Is the pet training ?
var $trainingend '00000000'//When does training end?
var $ownerid 1//Owner of the pet


//These vars depend on the breed and are loaded up in the free file.
var $breed 'No Breed'//The breed of the pet
var $breed_desc 'No Breed Desc'//The description of the breed.
&#160; &#160; var $price = 700; //The price to purchase one of these pets
&#160; &#160; var $breed_img = 'blank.jpg'; //The img file of the breed
&#160; &#160; var $skills_cnt = 0; //Number of skills owned by the pet.

// -----------------------------------------------------------------------
//Lots of functions to make life easier everywhere else


//The view function that people see on your pets profile
function view_Pet() {
global $txt$sourcesdir;
switch ($this->happy) {
case 0$happy "Very Depressed"; break;
case 1$happy "Sad"; break;
case 2$happy "Sad"; break;
case 3$happy "Gloomy"; break;
case 4$happy "Gloomy"; break;
case 5$happy "Content"; break;
case 6$happy "Content"; break;
case 7$happy "Happy"; break;
case 8$happy "Happy"; break;
case 9$happy "Joyous"; break;
case 10$happy "Joyous"; break;
case 11$happy "Joyous"; break;
case 12$happy "Gleeful"; break;
case 13$happy "Gleeful"; break;
case 14$happy "Gleeful"; break;
default: $happy "Excstatic"; break;
}
switch ($this->hunger) {
case 0$hunger "Starving"; break;
case 1$hunger "Very Hungry"; break;
case 2$hunger "Very Hungry"; break;
case 3$hunger "Hungry"; break;
case 4$hunger "Hungry"; break;
case 5$hunger "Content"; break;
case 6$hunger "Content"; break;
case 7$hunger "Happy Tummy"; break;
case 8$hunger "Happy Tummy"; break;
case 9$hunger "Full"; break;
case 10$hunger "Full"; break;
case 11$hunger "Full"; break;
case 12$hunger "Very Full"; break;
case 13$hunger "Very Full"; break;
case 14$hunger "Very Full"; break;
default: $hunger "Bloated"; break;
}
return "
<table width='85%' cellpadding='5' cellspacing='0' border='1' align='center'>
<tr class = 'titlebg2'><th colspan='6'>"
.$this->name." the ".$this->breed."</th></tr>
<tr class = 'middletext'><td colspan='1' rowspan='3' width='10%'><img border='0' src='"
.$sourcesdir."/forum/Sources/shop/pet_images/".$this->breed_img."' alt='".$this->breed."' />
&#160; &#160; <th colspan='1' width='20%'>"
.$txt['pets_name']."</th>
&#160; &#160; <td colspan='1'>"
.$this->name."</td>
&#160; &#160; <th colspan='1' width='20%'>"
.$txt['pets_breed']."</th>
<td colspan='2'>"
.$this->breed."</td></tr>
<tr><th colspan='1' width='10%'>"
.$txt['pets_happy']."</th>
<td colspan='1'>"
.$happy."</td>
<th colspan='1'>"
.$txt['pets_hunger']."</th>
<td colspan='1'>"
.$hunger."</td></tr>
<tr><th colspan='1' width='20%'>"
.$txt['pets_level']."</th>
<td colspan='1'>"
.$this->level."</td>
<th colspan='1' width='20%'>"
.$txt['pets_age']."</th>
<td colspan='2'>"
.sprintf($txt['pets_days'], $this->age)."</td></tr>
<tr><th colspan='1'>"
.$txt['pets_description']."</th>
<td colspan='5'>"
.$this->desc."</td></tr>";
}


//The view function that you see on your pets menu. Allows for skills and such.
function view_Pet_owner() {
global $txt$sourcesdir;
return "
<table width='75%' cellpadding='5' cellspacing='0' border='1' align='center'>
<tr 'titlebg2'><th colspan='6'>"
.$this->name." the ".$this->breed."</th></tr>
<tr><td colspan='1' rowspan='3' width='10%'><img border='0' src='"
.$sourcesdir."/forum/Sources/shop/pet_images/".$this->breed_img."' alt='".$this->breed."' />
&#160; &#160; <th colspan='1' width='20%'>"
.$txt['pets_name']."</th>
&#160; &#160; <td colspan='1'>"
.$this->name."</td>
&#160; &#160; <th colspan='1' width='20%'>"
.$txt['pets_breed']."</th>
<td colspan='2'>"
.$this->breed."</td></tr>
<tr><th colspan='1' width='10%'>"
.$txt['pets_happy']."</th>
<td colspan='1'>"
.$this->happy."</td>
<th colspan='1'>"
.$txt['pets_hunger']."</th>
<td colspan='1'>"
.$this->hunger."</td></tr>
<tr><th colspan='1' width='20%'>"
.$txt['pets_level']."</th>
<td colspan='1'>"
.$this->level."</td>
<th colspan='1' width='20%'>"
.$txt['pets_age']."</th>
<td colspan='2'>"
.sprintf($txt['pets_days'], $this->age)."</td></tr>
<tr><th colspan='1'>"
.$txt['pets_description']."</th>
<td colspan='5'>"
.$this->desc."</td></tr>
<tr><th colspan='6'>"
.$txt['pets_do_stuff'].$this->curap."/".$this->maxap.")</th></tr>
<tr><th colspan='1' width='10%'>"
.$txt['pets_use_skill']."</th>
<td colspan='2'>"
.$this->skillsMenu()."</td>
<th colspan='1' width='10%'>"
.$txt['pets_train']."</th>
<td colspan='2'>"
.$this->trainMenu()."</td></tr>
<tr><th colspan='1' width='10%'>"
.$txt['pets_rename']."</th>
<td colspan='2'>"
.$this->renameMenu()."</td>
<th colspan='1' width='10%'>"
.$txt['pets_describe']."</th>
<td colspan='2'>"
.$this->describeMenu()."</td></tr></table><br />";
}

//Skills menu. Called by avove function. Used to make things nicer.
function skillsMenu() {
global $txt$scripturl;
$this->load_breed();
$returnstring "<form method='post' action='".$scripturl."?action=shop;do=pets;type=skills;pet=".$this->id."'><select name='skill'>";
$cnt 0;
for ($i 0$i $this->skills_cnt$i++) {
if ($this->skill[$i]->level_learn <= $this->level && $this->skill[$i]->cost <= $this->curap) {
$cnt++;
$returnstring .= "<option value=".$i." selected = 'selected'>".$this->skill[$i]->name." (Cost: ".$this->skill[$i]->cost."SP)</option>";
}
}
if ($cnt == 0) {
$returnstring $txt['pets_no_skills'];
}
else {
$returnstring .= "<input type='submit' value='{$txt['pets_use_skill']}'></form>";
}
}

//Train menu. Called by avove function. Used to make things nicer.
function trainMenu() {
global $txt$scripturl;
&#160;  $date = date('z');
&#160;  if ($date < 10) {
&#160;  $date = '00'.$date;
&#160;  }
&#160;  elseif ($date < 100) {
&#160;  $date = '0'.$date;
&#160;  }
&#160;  $date = date('y').$date.date('His');
if ($this->training == 1) {
if ($date $this->trainingend){
$middlestring $txt['pets_course_finish2'];
$command $txt['pets_train_pet'];
$returnstring "<form method='post' action='".$scripturl."?action=shop;do=pets;type=train;pet=".$this->id."'> ";
$returnstring .= $middlestring;
$returnstring .= " <input type='submit' value='{$command}'></form>";
}
else{
$middlestring sprintf($txt['pets_course_taking'], $this->training_date($this->trainingend));
$command $txt['pets_train_pet'];
$returnstring "<form method='post' action='".$scripturl."?action=shop;do=pets;type=train;pet=".$this->id."'> ";
$returnstring .= $middlestring;
}
}
else {
$middlestring $txt['pets_train_cost'].formatMoney($this->calcTrainCost());
$command $txt['pets_train'];
$returnstring "<form method='post' action='".$scripturl."?action=shop;do=pets;type=train;pet=".$this->id."'> ";
$returnstring .= $middlestring;
$returnstring .= " <input type='submit' value='{$command}'></form>";
}
return $returnstring;
}

//Rename. Called by avove function. Used to make things nicer.
function renameMenu() {
global $txt$scripturl;
$returnstring "<form method='post' action='".$scripturl."?action=shop;do=pets;type=rename;pet=".$this->id."'>";
$returnstring .= "<input type='text' name='newname' value='{$this->name}'>";
$returnstring .= "<input type='submit' value='{$txt['pets_rename']}'></form>";
return $returnstring;
}

//Describe menu. Called by avove function. Used to make things nicer.
function describeMenu() {
global $txt$scripturl;
$returnstring "<form method='post' action='".$scripturl."?action=shop;do=pets;type=describe;pet=".$this->id."'>";
$returnstring .= "<input type='text' name='newname' value='{$this->desc}'>";
$returnstring .= "<input type='submit' value='{$txt['pets_describe']}'></form>";
return $returnstring;
}

//Training cost. Set to n * (n+1)*5 where n is the current level.
function calcTrainCost() {
return ($this->level) * ($this->level 1) * 4
}

//Using a skill
function use_skill($skillid 0) {
global $txt;
$this->load_breed();
$min_level $this->skill[$skillid]->level_learn;
$max $this->skill[$skillid]->level_max;
$cost $this->skill[$skillid]->cost;

if ($cost $this->curap) {
return $txt['pets_skill_no_power'];
}
elseif ($this->hunger 5) {
return $txt['pets_skill_hunger'];
}
elseif ($this->happy 5) {
return $txt['pets_skill_happy'];
}
else {
if ($this->level $min_level$chance 0;
elseif ($this->level $max$chance floor(100 * ($this->level $min_level) / ($max $min_level));
else $chance 100;
$rand mt_rand(1,100);
if ($rand $chance) {
$this->curap -= $cost;
return $txt['pets_skill_fail'];
}
else {
$this->curap -= $cost;
eval('$return = $this->use_skill_' $skillid '();');
return $return;
}
}
}

//Change a pets name
function rename_pet($newname 'No Name') {
$this->name $newname;
}

//Change a pets description
function redesc_pet($newdesc 'No Desc') {
$this->desc $newdesc;
}

//Store the values back into the database(very important)
function store_values() {
global $db_prefix;
$result db_query("UPDATE {$db_prefix}shop_pets
SET name = '
{$this->name}',
&#160; &#160; level = 
{$this->level},
&#160; &#160; curap = 
{$this->curap},
&#160; &#160; maxap = 
{$this->maxap},
&#160; &#160; happy = 
{$this->happy},
&#160; &#160; `desc` = '
{$this->desc}',
&#160; &#160; hunger = 
{$this->hunger},
&#160; &#160; age = 
{$this->age},
&#160; &#160; training = 
{$this->training},
&#160; &#160; trainingend = '
{$this->trainingend}',
&#160; &#160; ownerid = 
{$this->ownerid}
&#160; &#160; WHERE pet_id = 
{$this->id}"__FILE____LINE__);
}

//Load the values from the database(also important)
function load_values($id 0) {
global $db_prefix;
if ($id != 0) {
$result db_query("SELECT * FROM {$db_prefix}shop_pets
WHERE pet_id = 
{$id}"__FILE____LINE__);
$row mysql_fetch_assoc($result);
$this->name $row['name'];
$this->breed $row['breed'];
$this->desc $row['desc'];
$this->level $row['level'];
$this->curap $row['curap'];
$this->maxap $row['maxap'];
$this->age $row['age'];
$this->happy $row['happy'];
$this->hunger $row['hunger'];
$this->training $row['training'];
$this->trainingend $row['trainingend'];
$this->ownerid $row['ownerid'];
$this->id $row['pet_id'];
$this->load_breed();
}
}

//Advance a day(yay)
function advance_day() {
global $db_prefix;
$happy_loss mt_rand(1,4) - 1;
$hunger_loss mt_rand(1,2);
if ($this->happy $happy_loss 0$happy_loss $this->happy;
if ($this->hunger $hunger_loss 0$hunger_loss $this->hunger;
$this->happy $this->happy $happy_loss;
$this->hunger $this->hunger $hunger_loss;
$this->age++;
$this->curap $this->maxap;
}
&#160;  
&#160;  //Training a pet
&#160;  function train_pet() {
global $db_prefix$ID_MEMBER$txt;
&#160;  $date = date('z');
&#160;  if ($date < 10) {
&#160;  $date = '00'.$date;
&#160;  }
&#160;  elseif ($date < 100) {
&#160;  $date = '0'.$date;
&#160;  }
&#160;  $date = date('y').$date.date('His');
&#160;  if ($this->training != 1) {
&#160;  $cost = $this->calcTrainCost();
&#160;  $result = db_query("SELECT * from {$db_prefix}members WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);
&#160;  $row = mysql_fetch_assoc($result);
&#160;  if ($row['money'] < $cost) {
&#160;  return $txt['pets_no_train_money'];
&#160;  }
&#160;  else {
$result db_query("
UPDATE 
{$db_prefix}members
SET money = money - 
{$cost}
WHERE ID_MEMBER = 
{$ID_MEMBER}"__FILE____LINE__);
&#160;  $this->training = 1;
&#160;  $this->trainingend = $this->training_end($date);
&#160;  return sprintf($txt['pets_place_course'], $this->training_date($this->trainingend));
&#160;  }
&#160;  }
&#160;  else {
&#160;  if ($date > $this->trainingend) {
&#160;  $this->level++;
&#160;  if ($this->level == 10) $this->maxap++;
&#160;  if ($this->level == 30) $this->maxap++;
&#160;  if ($this->level == 60) $this->maxap++;
&#160;  if ($this->level == 100) $this->maxap++;
&#160;  $this->training = 0;
&#160;  return sprintf($txt['pets_course_finish'], $this->level);
&#160;  }
&#160;  else {
&#160;  return sprintf($txt['pets_course_taking'], $this->training_date($this->trainingend));
&#160;  }
&#160;  }
}

//Finding the ending training date
function training_end($date '00000000000') {
$train_hours $this->level 4;
$dates preg_split('//'$date); 
$cur_year $dates[1].$dates[2];
$cur_date $dates[3].$dates[4].$dates[5];
$cur_hour $dates[6].$dates[7];
$cur_minsec $dates[8].$dates[9].$dates[10].$dates[11];
$hour $cur_hour $train_hours;
$extra_days 0;
while ($hour >= 24) {
$hour $hour 24;
$extra_days++;
}
if ($hour 10) {
$hour "0".$hour;
}
$cur_date += $extra_days;
if (date('L') == && $cur_date >= 365) {
$cur_year++;
$cur_date $cur_date 365;
}
elseif (date('L') == && $cur_date >= 366) {
$cur_year++;
$cur_date $cur_date 366;
}
if ($cur_date 10) {
$cur_date '00'.$cur_date;
}
elseif ($cur_date 100) {
$cur_date '0'.$cur_date;
}
return $cur_year.$cur_date.$hour.$cur_minsec;
}

function training_date($date '00000000000') {
$dates preg_split('//'$date); 
$cur_year $dates[1].$dates[2];
$cur_date $dates[3].$dates[4].$dates[5];
$cur_hour $dates[6].$dates[7];
$cur_min $dates[8].$dates[9];
$cur_sec $dates[10].$dates[11];
$cur_hour++;
$month 1;
$cur_date++;
if ($cur_date 31) {
$cur_date $cur_date 31;
$month++;
if ($cur_date 28 && date('L') == 0) {
$cur_date $cur_date 28;
$month++;
if ($cur_date 29 && date('L') == 1) {
$cur_date $cur_date 29;
$month++;
if ($cur_date 31) {
$cur_date $cur_date 30;
$month++;
if ($cur_date 30) {
$cur_date $cur_date 31;
$month++;
if ($cur_date 31) {
$cur_date $cur_date 30;
$month++;
if ($cur_date 30) {
$cur_date $cur_date 31;
$month++;
if ($cur_date 31) {
$cur_date $cur_date 30;
$month++;
if ($cur_date 31) {
$cur_date $cur_date 31;
$month++;
if ($cur_date 30) {
$cur_date $cur_date 30;
$month++;
if ($cur_date 31) {
$cur_date $cur_date 31;
$month++;
if ($cur_date 30) {
$cur_date $cur_date 30;
$month++;
}
}
}
}
}
}
}
}
}
}
}
}
return date("H:i:s, F jS Y"mktime($cur_hour00$month$cur_date$cur_year));
}
}
}

//Simple class to handle skills
if (!class_exists('skill')) {
class skill {
var $level_learn 0;
var $level_max 0;
var $cost 1;
var $name 'Skill';
var $code 'return "This skill does nothing"';
}
}
?>
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on March 25, 2007, 01:26:46 pm
I donno why the skills are not showing up. Everything looks fine to me. Sorry. Try uploading the basic pet and seeing if that has skills...
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: littleone on March 25, 2007, 04:50:09 pm
Like i said it was fine until I went to use it the first time.  I had just purchased the pet and went to use a skill.  It gave me a message saying something like I wasnt trained enough to use it, and it disappeared, so I went to train the animal.  Well I have purchased a couple more animals and now they come with out it to begin with.

If possible, would it be possible to get someone to give me a clean copy of the Pet-Shops and the pet_engine files?  I have done the 0.1 update, so i know that is good.  TY
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on March 25, 2007, 09:17:33 pm
You could always download the 0.0 version. But seriously... it shouldn't be doing this. It should show all skills that you have the power to use and the level to use. So you should see some skills. o_0 The fact that you do not even get the "no skills" message is equally troubling.
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: littleone on March 26, 2007, 02:06:25 am
Ok well I know its one of the changes that was done with 0.1.  When I put the original pet_engine from 0.0 up its perfectly fine, but as soon as I make the changes it disappears.  Would you be able to look into that and see what might be the cause?
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: littleone on March 26, 2007, 02:14:58 am
Ok I have narrowed the problem down ti this bit of code change:

Code: [Select]
<operation>
<search position="replace"><![CDATA[
for ($i = 0; $i < $this->skills_cnt; $i++) {
if ($this->skill[$i]->level_learn <= $this->level) {
$returnstring .= "<option value=".$i." selected = 'selected'>".$this->skill[$i]->name." (Cost: ".$this->skill[$i]->cost."SP)</option>";
}
}
$returnstring .= "<input type='submit' value='{$txt['pets_use_skill']}'></form>";
]]></search>
<add><![CDATA[
$cnt = 0;
for ($i = 0; $i < $this->skills_cnt; $i++) {
if ($this->skill[$i]->level_learn <= $this->level && $this->skill[$i]->cost <= $this->curap) {
$cnt++;
$returnstring .= "<option value=".$i." selected = 'selected'>".$this->skill[$i]->name." (Cost: ".$this->skill[$i]->cost."SP)</option>";
}
}
if ($cnt == 0) {
$returnstring = $txt['pets_no_skills'];
}
else {
$returnstring .= "<input type='submit' value='{$txt['pets_use_skill']}'></form>";
}
]]></add>
</operation>
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on March 26, 2007, 02:23:29 am
Yeah. I know. I just donno what is causing said error. $cnt should be non-zero(because you have skills) so everything should work.

Is anyone else having a problem with 0.1?
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: GhostWriter on March 26, 2007, 02:51:44 am
My permissions are my only problem...I can't do anthing with pets...
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Lady Ambrosia on March 26, 2007, 03:02:32 am
I'm not having any troubles with skills, I used one on my pet, and it came up like it was supposed to.  So far so good in my neck of the woods.
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on March 26, 2007, 05:06:00 am
This is why this package will probably never be official. I donno enough to actually help people fix their problems. XD Now I feel sad. Hopefully technodragon or daniel will come to my rescue!
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Lady Ambrosia on March 26, 2007, 06:46:35 am
Oh don't feel sad, it's a GREAT mod it really is!  There's a possibility that it's probably not on your end, sometimes servers themselves can make a HUGE difference; I'm saying this because I can tell a HUGE difference in my Test site, as it's free and doesn't do the code properly, but with my main site, things will work like a charm, of course I pay for it too.

I think you should continue to work on this mod, as it's an awesome mod, and is LOADS of fun!!
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: GhostWriter on March 26, 2007, 07:15:57 am
I agree with Lady Ambrosia, this is an awesome mod and you should keep at it, that is really the only way to improve it. Some of the problems that are coming should also be expected since it is in it's child stages still. Give it time and things will be fixed up with it to where it works for eveyone. You also have to take into theconsideration that with SMF1.1.2 being out, there is some differences with it then when you made this mod.


With all the knowledge of PHP from this site, someone is bound to solve the issues that you don't aren't sure about, but please don't take anything away from yourself, I could have never coded anything like this at all. 
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: tamibrown on March 27, 2007, 02:09:33 am
I have a member who wants to get rid of one of her pets......is there a way to do this?
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on March 27, 2007, 03:29:09 am
No, other than editing the database, you cannot get rid of pets yet. Sorry.
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: littleone on March 27, 2007, 06:18:28 am
Getting a couple of errors in my logs id like to fix:

8: Undefined index: profile_show_pets_2
File: /home/xxxxxxxxxxxxxx/public_html/forum/Themes/default/Profile.template.php
Line: 598

8: Undefined index: showPets
File: /home/xxxxxxxxxxxxx/public_html/forum/Sources/Profile.php
Line: 350

8: Undefined index: shop_buy_message
File: /home/xxxxxxxx/public_html/forum/Sources/shop/Shop-Pets.php
Line: 146
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: inkstains on March 30, 2007, 03:31:10 pm
hey Basil Beard

just wondering, i'm look at adding the 0.1 upgrade cause i'd like the training fixes i'm just curious what will be affected i've made a few changes to my pet store and just wondering if they will cause issues also will all the pets remain as they are as in peoples levels etc

cheers

EDIT: ignore this have just done a backup and then applied everything appears to be working fine

cheers


EDIT2: actually my pet images in the pet central section have stopped working i had worked around the previous problem by creating a new pet_images folder in the root of my server directory but now it doesn't work it appears to be calling the images from the original pet_images folder but this folder also contains all the images but still fail to display

any ideas?

EDIT3: haha so many edits anyway i've sorted the images i just changed my image paths to

Code: [Select]
src='".$boardurl."/*forumdirectory*/Sources/shop/pet_images/".$this->breed_img."'
in case anyone else has this issue
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Lucid_Dream on March 31, 2007, 09:48:18 am
Is that edit in pet_engine.php?
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: inkstains on March 31, 2007, 09:56:59 am
yeh in pet_engine.php
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Lucid_Dream on March 31, 2007, 09:58:49 am
hmm, still not working for me, the img comes up in the hatchery but not the pet centre

[Edit] got i working thanks :P

Just a few things my members asked me about.

Will we ever be able to fight other peoples pets?
Will there be an in forum menu where other people can see ur pets? (like the smf arcad thing of showing the games u have top score in)
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: inkstains on March 31, 2007, 10:20:31 am
did you change that code in both places in the pet_engine.php file

also have you done the upgrade?
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: inkstains on March 31, 2007, 04:34:03 pm
hope this is cool with Basil

wanted users to be able to terminate their pets if/when they wanted seeing as Basil doesn't appear to have much time thought i'd throw the code changes up here for anyone who would like to do the same

This is all done on a 0.1 updated version of pets i'm not sure if the code is any different between 0.0 and 0.1 so if you try it on a 0.0 version it might be a bit different

in Shop-Pets.php find

Code: [Select]
$temp->store_values();
and above that copy and past the below code

Code: [Select]
///BEGIN KILL
                        elseif ($_GET['type'] == 'kill') {
                                $context['shop_buy_message'] = sprintf('Your pet has been put down');
                                $result = db_query("UPDATE {$db_prefix}members SET numpets = numpets - 1 WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);
        $result = db_query("DELETE FROM {$db_prefix}shop_pets WHERE pet_id = {$_GET['pet']}", __FILE__, __LINE__);
                        }
///END KILL

then in pet_engine.php find

Code: [Select]
</tr></table><br />";
and before that copy and paste the below code

Code: [Select]
<tr><th colspan='4'>NOTE: This action is permanent and cannot be undone</th>
<td colspan='1'>".$this->killMenu()."</td></tr>

again in pet_engine.php find

Code: [Select]
//Training cost. Set to n *
above that copy and paste the below code

Code: [Select]
//BEGIN KILL
function killMenu() {
global $txt;
                $returnstring = "<form method='post' action='".$scripturl."?action=shop;do=pets;type=kill;pet=".$this->id."'>";
$returnstring .= "<input type='submit' value='Put your pet down'></form>";
                return $returnstring;
}
///END KILL

and that's it if everything went cool you should have a new button and message in your pet central


Basil Beard

i tried to keep this as close to the way you were putting things together as i could but there were a few things i couldn't work out cause i was to tired or whatever but could you point me in the right direction? so i can tidy it up a bit.

first was were you set the value for the text of the buttons on the input=submit stuff in pet_engine.php i had a look but couldn't find them maybe i was just a lil blind though and also the things like pets_describe that has what to do on that area that's all i can think of at the moment but yeh any help would be cool


cheers/enjoy



EDIT: it would be good to do a confirmation screen as well but i haven't bother to look at that yet just wanted to get it working
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Lucid_Dream on March 31, 2007, 10:41:26 pm
Basil thanks alot for this mod.

http://www.opiate2.com/images/Bear.zip  // just a quick pet it only has one skill but it will get you started.
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on April 01, 2007, 12:17:17 am
You probably will want to add some sort of confirm screen for killing your pet. I know how easy it is ti miss click and wouldn't want to accidentally kill a pet I wanted =P
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: inkstains on April 01, 2007, 12:52:01 am
yeh i was saying that in my edit as i did exactly that no long after to a pet that was 19 days old and level 14 :-(

haven't really had a look at it yet you got any ideas on how i would do it?
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: tamibrown on April 01, 2007, 01:33:47 am
That works wonders!  I had a few owners who had pets they bought when I was still working the kinks out of everything that their pets got stuck in training, and couldnt get them out.  This allows them to get rid of those pets.
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: animecosmo on April 01, 2007, 01:17:02 pm
I am getting a "The package you are trying to download or install is either corrupt or not compatible with this version of SMF." error on the 0.1 version. Do I have to install the first version before trying the second version?
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Lady Ambrosia on April 01, 2007, 05:34:13 pm
You need to install the first pet version, THEN install 0.1, as it's an update.
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: perplexed on April 02, 2007, 12:04:48 am
I *still* have no pet images in pet central - see page 5.  I tried that code but I just got parse errors as per my post on page 5

I have installed the pet upgrade hoping that might have fixed it but I still have no pictures

Can anyone please help with this?




edited to add:  also how do I add a new pet?  I cant find anywhere to add new pets.  I think something has gone wrong somewhere  *feels dumb*
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: inkstains on April 02, 2007, 12:44:55 am
check this post for ya pictures and see if the edit offered works

http://www.daniel15.com/forum/index.php/topic,642.msg3973.html#msg3973

as for where to load the pets, you upload your pets php file to the pets_breeds folder

Title: Re: SMFPets is Finally Here (0.1 out)
Post by: perplexed on April 02, 2007, 12:47:31 am
thats cool, thanks.  I just tried those edits and my pet image is there!

Its been a while since I looked at this and I couldnt remember where to upload the pets - I was thinking it was something via the shop

thanks for your help
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: perplexed on April 02, 2007, 01:25:58 am
Ok I added a new pet and then tried to buy it but it says

You are not allowed any more pets!!!

I only have one, is it set somewhere that you can only have one pet or did I do something bad that I can't have any more?
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Lucid_Dream on April 02, 2007, 03:55:14 am
You have to buy a pet cage in ur shop, this increases the amount of pets u can have.
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: perplexed on April 02, 2007, 04:08:39 am
ok, I bought a cage - I still cant have another pet

I went into the database and deleted my existing pet - I still cant have another pet

so now I have no pet and everytime I try to buy one it says

You are not allowed any more pets!!!
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Lucid_Dream on April 02, 2007, 04:11:33 am
did u use the cage.  Buying it aint enough, u have to use it like a normal item.
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: perplexed on April 02, 2007, 04:14:59 am
yeah I did and it still didnt make any difference :(

I'll go look again...
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: perplexed on April 02, 2007, 04:17:30 am
ok, it worked that time but...

It said I could have up to two pets - but I have no pets as I deleted the first pet from the database - so I bought a pet.  that was ok, but then I tried to buy a second pet and it said I couldnt have any more.

I think I messed up somewhere when I deleted pet 1 as it might think I still have it.


edited to add:  I bought another cage (should give me 3 pets)  I managed to buy a 2nd pet, but I dont know how to fix the error now as it thinks I have three lol

not a big deal as its a test site unless it expects me to do things with my pet and it aint there  :D
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: inkstains on April 02, 2007, 09:28:26 am

you need to access your database through phpMyAdmin or whatever and change your numpets value in the smf_members table (just look for your username) to whatever the correct value of pets should be
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: perplexed on April 02, 2007, 09:57:20 am
ok I tried to do that and got some huge error in phpmyadmin.  I dont know why but I will try again in the morning
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: animecosmo on April 02, 2007, 10:02:31 am
You need to install the first pet version, THEN install 0.1, as it's an update.

It's still saying the package is corrupt. Is it a package where I have to just add the unzipped files to the pets directory and overwrite some files, or should it work in the forum package manager? I didn't see any instructions on the download page.

Also, how do I actually access the pets? I can see the cage and food in the store, and it let me set them up for sale no problem.
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: David on April 02, 2007, 10:05:44 am
 I'm getting exactly the same problems as perplexed has reported...fair enough I can get around them the same way he will but I suspect that they may be php version related...I'm running on php5.2.1 and have quite a few undefined index and undefined constant errors in my error log. I've edited all the pet items to remove line 2 entirely and also one of the brackets at the end of each file so as to avoid a flurry of undefined constant reports from them but am left with reports as below:

Undefined index: shop_buy_message
File: /home/****/emptySMF/Sources/shop/Shop-Pets.php
Line: 146

Use of undefined constant skill - assumed 'skill'
File: /home/****/emptySMF/Sources/shop/pet_engine.php
Line: 481

Use of undefined constant petTemplate - assumed 'petTemplate'
File: /home/****/emptySMF/Sources/shop/pet_engine.php
Line: 33

 Is it possible that the php version I'm running on is the cause of these errors and if so could some kind person point me towards a solution for them (or if they're really kind give me the fixed code...if you don't ask you don't get.)

BTW I'm using a test forum with nothing bar the shop and errors at top mods installed and haven't altered the files mentioned in the error log...running the pets upgrade too.

 Thanks
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: David on April 02, 2007, 10:07:39 am
You need to install the first pet version, THEN install 0.1, as it's an update.

It's still saying the package is corrupt. Is it a package where I have to just add the unzipped files to the pets directory and overwrite some files, or should it work in the forum package manager? I didn't see any instructions on the download page.

Forum package manager for both the original and the upgrade. Have you tried getting the packages via a different browser...that sometimes helps.
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Lady Ambrosia on April 02, 2007, 11:23:42 am
You need to install the first pet version, THEN install 0.1, as it's an update.

It's still saying the package is corrupt. Is it a package where I have to just add the unzipped files to the pets directory and overwrite some files, or should it work in the forum package manager? I didn't see any instructions on the download page.

Forum package manager for both the original and the upgrade. Have you tried getting the packages via a different browser...that sometimes helps.

Exactly what David here has said.  I have noticed that sometimes when downloading a mod package, from a different browser seems to help.
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: perplexed on April 03, 2007, 09:42:37 am
I have two pets

both are at happiness 20 and lack of hunger 20

however I just bought pet food for both of them and used it.  After I used it I got this message

pet 1 - - does *something* with the item, you are not exactly sure what and neither is fred2. But at least it's lack of hunger is now 84 and it's happiness 134!

Pet 2 - does *something* with the item, you are not exactly sure what and neither is fred. But at least it's lack of hunger is now 58 and it's happiness 108!

But when I look at both pets they both still say 20 and 20

Am I missing something?
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: inkstains on April 04, 2007, 12:47:54 pm
ummm which version of pets have you got? maybe you need to fix your food item

check this
http://www.daniel15.com/forum/index.php/topic,642.msg3485.html#msg3485



i've got all those errors in my logs as well but pets still works fine so not a real worry
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: perplexed on April 04, 2007, 06:24:56 pm
the errors arent in the log - actually  Ihavent looked in the log - that is what I see in pet central despite what the message said its supposed to have done to them

I will go look at the other thread
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: perplexed on April 04, 2007, 08:40:26 pm
I have two pets

both are at happiness 20 and lack of hunger 20

however I just bought pet food for both of them and used it.  After I used it I got this message

pet 1 - - does *something* with the item, you are not exactly sure what and neither is fred2. But at least it's lack of hunger is now 84 and it's happiness 134!

Pet 2 - does *something* with the item, you are not exactly sure what and neither is fred. But at least it's lack of hunger is now 58 and it's happiness 108!

But when I look at both pets they both still say 20 and 20

Am I missing something?

sorry, lots of questions:

1.  It's definitely not updating the hunger / happiness thing, as now two days later  one pet says happiness 18 hunger 17 and the other happiness 17  hunger 18

I didnt look at them again since I posted the above message when they were both at 20 /20, so that bit makes sense I guess, but what happened to the hunger/happiness they both got for eating the food?    *see above*


2.  Also, I don't have a view pet's link in profiles or posts - am I supposed to?  How do other people see your pets or know you have one?


3. Also (sorry) but could someone/has someone written a instruction guide for members?  Just something basic explaining what to do with your pet and how things work? As I can see people getting confused and I'm not sure how it all works.


4. Sorry, one more...  when you put your pet on a course and it tells you to check back at whatever time.  What time is it using?
It's definitely not using the forum time as its 12:38pm here and it told me to check back at 12:04pm 4th April.
Does it use the time where the server is located perhaps?  If so, can I change it to forum time or something because that's really going to confuse people.

sorry for all the questions
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on April 04, 2007, 10:50:01 pm
I donno what is up with food. I havn't had a lot of free time lately, but hopefully will be able to make some time to fix some of the bugs people have been having.

View pets links are not in posts yet. They should be in the profile though, providedyou use the default theme.

So the time is a little off. Because I used m(month) for minutes(should be an i). I thought I had fixed that with 0.1 though o_0
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: perplexed on April 04, 2007, 10:56:04 pm
I am using the version with 0.1 upgrade and the time is definitely off but I wasnt sure if it was a time diff thing with the server or a problem with the pets
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: TechnoDragon on April 09, 2007, 11:40:39 pm
Like i said it was fine until I went to use it the first time.  I had just purchased the pet and went to use a skill.  It gave me a message saying something like I wasnt trained enough to use it, and it disappeared, so I went to train the animal.  Well I have purchased a couple more animals and now they come with out it to begin with.

If possible, would it be possible to get someone to give me a clean copy of the Pet-Shops and the pet_engine files?  I have done the 0.1 update, so i know that is good.  TY

Sorry I have been away for so long...Littleone, When you bring up your pets and the skill list is missing, do any errors show up in your error log?
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: sasafetch on April 13, 2007, 11:41:18 am
Get the following error when trying to level up my pet:

Quote
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's cool, and he's blue.',
hunger = 10,
age = 0,
' at line 7
File: /home/ninjasan/public_html/forum/Sources/shop/pet_engine.php
Line: 298

Note: It appears that your database may require an upgrade. Your forum's files are currently at version SMF 1.1.2, while your database is at version 1.1.1. The above error might possibly go away if you execute the latest version of upgrade.php.
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: sasafetch on April 13, 2007, 11:43:06 am
Never mind, figured it out.  On the other hand, I do have a problem where my pet's image won't show up after I buy it.  He shows up in the shop, but when i buy it and go to the center to train him and see his stats it just says his name.  What's wrong with that?
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: inkstains on April 13, 2007, 02:21:59 pm
Never mind, figured it out.  On the other hand, I do have a problem where my pet's image won't show up after I buy it.  He shows up in the shop, but when i buy it and go to the center to train him and see his stats it just says his name.  What's wrong with that?

a few pages back in this thread there is a fix for this
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: sasafetch on April 13, 2007, 04:37:45 pm
I figured it out, but now I have a problem when trying to feed a hungry pet with the food item.  I get the following error:

Quote
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE pet_id = 3 AND ownerid = 1' at line 1
File: /home/ninjasan/public_html/forum/Sources/shop/items/Food.php
Line: 82

Note: It appears that your database may require an upgrade. Your forum's files are currently at version SMF 1.1.2, while your database is at version 1.1.1. The above error might possibly go away if you execute the latest version of upgrade.php.

The pet has a hunger level of 9 and the item is supposed to increase it by 10.  What's wrong?  Why do I get a database crash here?
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on April 14, 2007, 12:38:29 am
I donno. Food works fine for me. Which version of the food are you using?
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: sasafetch on April 14, 2007, 12:39:51 am
i'm using the latest one.
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Jen on April 14, 2007, 02:07:12 am
Hello.

I just installed this today and I want to make sure I have everything and understand.

Install was fine, however, I don't have anything in the shop in admin control about adding pets. BUT there is a Pet Hatchery in the shop itself. Is this correct?

I don't see a Pet Central? Should I have that?

Thanks again.


EDIT: Got it, but when I went to use a skill, the image isnt showing up. Here is the property for the image

http://mysite.com/home/content/t/h/e/thegame212/html/board/Sources/shop/pet_images/Bird01.gif

It's like it added the server direc along with the actual site.


Edit #2

Fixed it, I had to edit the directories my images are in.

All is good now :) Cheers for this awesome addon.
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Jen on April 14, 2007, 04:24:27 am
OK, here's the skinny:

in Load.php find:
Code: [Select]
$row['options'] = array();
$user_profile[$row['ID_MEMBER']] = $row;
}
mysql_free_result($request);
add below that:
Code: [Select]
//Load the pet data
$request2 = db_query("
SELECT COUNT(*) AS pets, ownerid
FROM {$db_prefix}shop_pets
WHERE ownerid IN ('" . implode("', '", $loaded_ids) . "')
GROUP BY ownerid", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request2))
$user_profile[$row['ownerid']]['pets'] = $row['pets'];
mysql_free_result($request2);

then find:
Code: [Select]
'post_group' => $profile['post_group'],
add below:
Code: [Select]
//another pets modification
'pets' => &$profile['pets'],

then in the display template.php find the code you suggested and add this below instead:
Code: [Select]
//finally a pets button
if ($message['member']['can_view_profile']){
if($message['member']['pets'] > 0){
echo '
<a href="', $message['member']['href'], ';sa=showPets">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/icons/pets.gif" alt="' . $txt[27] . '" title="' . $txt[27] . '" border="0" />' : $txt[27]), '</a>';
}
}

this will only show the link to the members pets in profile on two conditions:
     1. person can view profiles
     2. member actually has a pet

there you go...ENJOY!

Perfect. One question, how can we set it to where when hovered over the paw image, it says View Pets instead of View Profile?
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: sasafetch on April 15, 2007, 03:03:57 am
Ok does anyone else have this problem?  I have TechnoDragon's pet items installed, namely increase max ap, increase happiness, and increase health.  I've also updated the pete engine tot he latest version.  0.1.  Now, my useres always get this error whenever they try to access the shop.  Aka, my entire shop is down now because something went wrong with the pet mod.  I keep getting these update database errors everywhere.  How the heck do I update my database?  And if I don't have to, what the hell is wrong??

Quote
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'red dangly part',
level = 1,
curap = 1,
maxap =' at line 2
File: /home/ninjasan/public_html/forum/Sources/shop/pet_engine.php
Line: 298

Note: It appears that your database may require an upgrade. Your forum's files are currently at version SMF 1.1.2, while your database is at version 1.1.1. The above error might possibly go away if you execute the latest version of upgrade.php.

It'd be nice if you guys could help me with this.  My entire site revolves around the shop system, and today is the day I tally the 2 different team's credit totals in order to determine whom is in control.  I can't really do that though, seeing as how the whole shop is down.  Help please.
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: sasafetch on April 15, 2007, 03:16:26 am
Never mind, i figured it out.  all of my problems keep happening because people keep putting apostrophes in the text fields.  Is there any way to format the pets mod so that it checks for these apostrophes and corrects them?
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: sjmarsha on April 18, 2007, 12:10:41 am
Hi everyone. I keep trying to download the SMF pets 0.1 version (I already have 0.0) but the download link will not work. Does anyone else have it that I can download? I have a few glitches and spelling errors I'd like to fix, hoping the update will fix them. I just wish I could download it. I tried this link - http://dev.dansoftaustralia.net/frs/?group_id=10 but I just get server timed out errors.
Thanks to anyone who can give me a new link or download to it!
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Jen on April 18, 2007, 12:18:10 am
Hmm, werid. Try this

http://www.soapoperanuts.com/SMfPets0-0_0-1.zip
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: sjmarsha on April 18, 2007, 12:29:44 am
That worked. Thank you so much!
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: sjmarsha on April 18, 2007, 12:52:12 am
ahhh dang, I still get the error -

Quote
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ' happy = happy + WHERE pet_id = 2 AND ownerid = 1' at line 1
File: /home/informed/public_html/forum/Sources/shop/items/Food.php
Line: 82

when I try to give food to my pet. I tried the food fix that was mentioned earlier on, but it didn't work. Anyone have any ideas on this error?
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on April 18, 2007, 02:24:35 am
Nope. SQL error's really bug me because they seem to crop up randomly.

And yeah. The dev server has been having trouble. Not alot I can do about that. Sorry!
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: sjmarsha on April 18, 2007, 02:28:12 am
Thanks Basil. Does this mean that I'm stuck with not being able to feed our pets? My members and I really like the pets, I'd hate to have to uninstall it now  :-\
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on April 18, 2007, 02:31:31 am
Ok. I think I see the error. Its setting happy = happy + nothing. Are you sure you properly created the item in the first place? It doesn't appear to have the food increase value set.
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: sjmarsha on April 18, 2007, 02:33:48 am
HA, I'm not sure about anything! I'm pretty clueless when it comes to this stuff. I install, I follow directions, thats all I'm good for here :) If you can tell me what to do I'll do it and thank you immensely if it works!
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on April 18, 2007, 02:35:13 am
So like, when you created the food item it should've prompted you for two values. One for like, the amount to reduce hunger and one for the amount to increase happiness.

Or are you still uses the other food item? In which case I have no idea how it works.  :D
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: sjmarsha on April 18, 2007, 02:39:02 am
this one I added to my items folder in sources/shop and then I added it using the add items manager in the admin panel under shop. It added and it didn't ask me for anything. I'll go delete and readd it, see if I just missed something the first time. If that doesn't work maybe I should use a different food.php?
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: sjmarsha on April 18, 2007, 02:44:17 am
I deleted and readded and now I found the thing you were talking about. It works fine now, WHEW!
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: sjmarsha on April 18, 2007, 02:50:18 am
one more little thing, does anyone know what file I would look into find this -
You have adpoted a new *insert breed*.. yay!

so that I could change the wording? I just want to change it to purchased or something instead of adopted or adpoted.

Thanks!!!
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on April 18, 2007, 08:12:57 am
Look in the shop.english file. Should be there  :)
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: sjmarsha on April 18, 2007, 08:20:50 am
it was! Thank you so much again. My site is for adoptees and adoptive parents so the adopt a virtual pet thing doesn't go over so well there :) All better now!  You rock!
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on April 19, 2007, 05:58:06 am
Can someone make a list of issues that need to be addressed and or features they would like?

Right now I have:

*Pet Images actually working
*Level Highscore List for Pets
*Link to members pets next to their posts.

Anything else?  :D
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: sjmarsha on April 19, 2007, 06:51:26 am
*personally* I'd like stuff like this -

Pets ready to use for those of us who aren't great at making our own stuff

Random events, such as on Gaia and Neopets, where just posting and browsing you could get an event on the forum saying "your pet has ____" or "your pet just found 250 credits and brought them to you" something like that.

Maybe a create a pet admin panel where you just enter the skills you'd like, description, upload and image, etc and it write the coding for you. Maybe even an option for "skills effects karma, when pet obtains this skill increase users karma by ____" feature or the same for credits or something.

More items like toys and stuff to interact with the pet that affects their moods and stuff. Maybe eventually pets could even have a personality with opinions "you give the ball to Chucky and he turns his nose up at it" or "you give Champ the dog treat and he gets a tummy ache from it and loses ___ happiness points"

Just thinking out loud



Title: Re: SMFPets is Finally Here (0.1 out)
Post by: David on April 19, 2007, 07:21:41 am
Frankly, and I don't mean this to sound ungrateful or unkind, the Pets mod is, for me and as it now stands, far too bug ridden to risk putting it on a live forum. I have it only on a test forum and on that it fills the error log with entry after entry. This makes me feel that the next release should be a bug fix one only with no feature creep at all.

 I'd love to be able to offer this system to my forum users and do think that it has the potential to be an excellent addition but right now, for me, it's unusable so my priority wish simply has to be to get it into a state where I could offer it on a live forum. I realise that others may not have the error log deluge from it that I get or may not have their error logs enabled at all, or may not care about such things...each to their own...

 I could let you have an admin account on the test forum I use for it...the forum has almost nothing else installed save the errors at top mod, shop and arcade and is on php 5.2.1 (that is, I rather think, the reason for my problems...php 5.x may well not live happily with the Pets mod.) The mod doesn't just produce a few errors...it produces truck loads of them. You're welcome to see for yourself why I don't feel it at all sensible to offer the mod as it is now on a live forum...at least one on the server configuration I have...again, other people may well find that it works perfectly for them.

 Sorry this sounds rather doom and gloom and may put a dampener on your mod but if it has problems for me it will, doubtless, have problems for other users so it's best that you know of them and have the chance to fix them.
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on April 19, 2007, 10:02:17 am
*personally* I'd like stuff like this -

Pets ready to use for those of us who aren't great at making our own stuff

Yeah. Starter pets are also in the works =)

Quote
Random events, such as on Gaia and Neopets, where just posting and browsing you could get an event on the forum saying "your pet has ____" or "your pet just found 250 credits and brought them to you" something like that.

The purpose of random events on Neopets is to encourage uses to play the site. The purpose of giving credits for posting accomplishes this, so there is little reason for random events.  O0

Quote
Maybe a create a pet admin panel where you just enter the skills you'd like, description, upload and image, etc and it write the coding for you. Maybe even an option for "skills effects karma, when pet obtains this skill increase users karma by ____" feature or the same for credits or something.
Create pet admin panel would be ideal for the final release, but won't be happening for a while. Probably it will be the last thing I do.  :buck2:

Quote
More items like toys and stuff to interact with the pet that affects their moods and stuff. Maybe eventually pets could even have a personality with opinions "you give the ball to Chucky and he turns his nose up at it" or "you give Champ the dog treat and he gets a tummy ache from it and loses ___ happiness points"

So, my next plan for food is to allow for custom consumption messages. Maybe after that I can also code items that have random effects--but in the same way that Daniel doesn't code all the items people want for the shop, i'll probably leave that as an extra feature people can code themselves.  :P

Frankly, and I don't mean this to sound ungrateful or unkind, the Pets mod is, for me and as it now stands, far too bug ridden to risk putting it on a live forum. I have it only on a test forum and on that it fills the error log with entry after entry. This makes me feel that the next release should be a bug fix one only with no feature creep at all.

Yeah. I am well aware of the bugstuff and will be attempting to clear some of that up.  Most likely everyone is getting the errors and only you are smart enough to care about.  :P

So it looks like my current list is:

*fixing images (done)
*highscore table(mostly done)
*link next to posts
*no errors generated
*starter pets
*upgrade food
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: perplexed on April 19, 2007, 10:36:41 am
off the top of my head, though these might not be what you have in mind:

a member guide on how to use the pets feature would be nice so I dont have to do it :)

more info on how to add/make skills

see the pets in member profiles as well as pet central? or optional

could the view link on posts be a mini thumbnail of the pet, or could you choose to show that or the blue paw, or a text link?

fix the problem with the time as it seems to be off (see previous post)

I had a problem with the food not increasing the pets happiness/health etc (see previous post) I dont know if thats a bug or what

a user guide and an admin guide maybe?

I can't think of anything else at the moment and its very late.

I don't have mine on a live forum yet, as I am still testing it and have had some little problems but no errors in the log.  I would love to be able to add it though :)




Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on April 19, 2007, 11:25:11 am
--a member guide on how to use the pets feature would be nice so I dont have to do it :)--

Isn't it pretty self explanatory? =P

--more info on how to add/make skills--

What more info do you want? I'd love to help here, but I am not sure what I can give.

--see the pets in member profiles as well as pet central? or optional--

Look closely. Its already there. You just need the default skin.

--could the view link on posts be a mini thumbnail of the pet, or could you choose to show that or the blue paw, or a text link?--

Probably will use a text link or that blue paw. What do people think would be best?

--fix the problem with the time as it seems to be off (see previous post)--
I'll look at it again, but it seems to be right for me.

--I had a problem with the food not increasing the pets happiness/health etc (see previous post) I dont know if thats a bug or what--
Again, I'll look at it, But I donno what could be causing it.

--a user guide and an admin guide maybe?--
What sort of guide do you want?
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Lady Ambrosia on April 19, 2007, 03:37:47 pm
My only suggestion would be to be able to place the pets in categories, for instance, like having a category that says Dogs, and when the user clicks on the Dog link they will be taken to dogs, where they can have different types or colors, whatever the admin adds.  Just general categories, I can name a few like Dogs, Cats, Birds, Fantasy, etc; but should the admin of need to add them they can.

Other than that I think that this mod is TOTALLY awesome, and I've not had any troubles, or am I just lucky? LOL
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: perplexed on April 19, 2007, 07:40:08 pm
--a member guide on how to use the pets feature would be nice so I dont have to do it :)--

Isn't it pretty self explanatory? =P 

No lol.  Maybe for people who have had pets on other places, but I'm trying to look at it from the POV of members who are seeing this for the first time, think 'oh goody I can have a pet', go to the shop, buy one, then wonder what they do with it and what it all means.  The skills, feeding and training, I think needs more explanation but maybe not from you, but from me  :P but since mine doesnt seem to function properly, its hard to explain how its supposed to work :)  Basically if I install it on a live forum, I dont want 100s of questions on day one, which I can see happening  :D

--more info on how to add/make skills--

What more info do you want? I'd love to help here, but I am not sure what I can give.

Yeah maybe not your job but I would like more guidance or examples of how to create them and make them work for each type of pet.

--see the pets in member profiles as well as pet central? or optional--

Look closely. Its already there. You just need the default skin.

 

I only have the default theme on my test forum and its really not there... I dont know if its a problem with the item or the forum.

--could the view link on posts be a mini thumbnail of the pet, or could you choose to show that or the blue paw, or a text link?--

Probably will use a text link or that blue paw. What do people think would be best?
If its a choice between the two, I would go with the paw symbol.  We already have two text links for the shop,dont want too many text links, they take up more space

--fix the problem with the time as it seems to be off (see previous post)--
I'll look at it again, but it seems to be right for me.
I can try reinstalling again and see if that makes any difference

--I had a problem with the food not increasing the pets happiness/health etc (see previous post) I dont know if thats a bug or what--
Again, I'll look at it, But I donno what could be causing it. 

yeah maybe if I reinstall... but currently its not doing what it tells you its doing

--a user guide and an admin guide maybe?--
What sort of guide do you want?

lol again maybe not your job to write a guide, but maybe more info in the pets area to say what its all about and what you can do.  Eg things like, buying a cage to get more pets, feeding the pets and what happens, how the skills work and what the purpose is, what happens during training and so on.   for admins, how to create new pets, new skills, how to set limits and so on

sorry don't mean to be a pain

My only suggestion would be to be able to place the pets in categories, for instance, like having a category that says Dogs, and when the user clicks on the Dog link they will be taken to dogs, where they can have different types or colors, whatever the admin adds.  Just general categories, I can name a few like Dogs, Cats, Birds, Fantasy, etc; but should the admin of need to add them they can.

Other than that I think that this mod is TOTALLY awesome, and I've not had any troubles, or am I just lucky? LOL


Categories!  good one

That would be great for forums with lots of different breeds :)
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: preddy25 on April 19, 2007, 08:14:27 pm
"8: Use of undefined constant petTemplate - assumed 'petTemplate'
File: /opt/lampp/htdocs/smf/Sources/shop/pet_engine.php
Line: 33"

hi can anyone help me out here? i installed the pets module accordingly onto the shops3.0 (which was working before) but after i install pets0.0 then updated to 0.1 , if i click on shop in the main menu , the following above shows up....i been reinstalling it for few times and still the same error occurs. everything works okay in the admin menu where i can create items for pets n such but if i click on user profile another error shows up
"
Fatal error: Cannot redeclare showpets() (previously declared in /opt/lampp/htdocs/smf/Sources/Profile.php:1522) in /opt/lampp/htdocs/smf/Sources/Profile.php on line 1561"

anyone pls help . tyvm, great mod by the way! a must have!

Title: Re: SMFPets is Finally Here (0.1 out)
Post by: perplexed on April 19, 2007, 08:17:49 pm
"8: Use of undefined constant petTemplate - assumed 'petTemplate'
File: /opt/lampp/htdocs/smf/Sources/shop/pet_engine.php
Line: 33"

hi can anyone help me out here? i installed the pets module accordingly onto the shops3.0 (which was working before) but after i install pets0.0 then updated to 0.1 , if i click on shop in the main menu , the following above shows up....i been reinstalling it for few times and still the same error occurs. everything works okay in the admin menu where i can create items for pets n such but if i click on user profile another error shows up
"
Fatal error: Cannot redeclare showpets() (previously declared in /opt/lampp/htdocs/smf/Sources/Profile.php:1522) in /opt/lampp/htdocs/smf/Sources/Profile.php on line 1561"

anyone pls help . tyvm, great mod by the way! a must have!



that redeclare message usually means you have duplicate code in there, probably because of all the reinstalling.  look at lines 1522 and 1561 and remove the duplicate code :)

the other one, I don't know what that is
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: preddy25 on April 19, 2007, 09:20:09 pm
yup you were right , both were duplicate codes , not too sure where though , could be inside the sql database?
i had reinstall the entire smf forums n mods , removed the smf entries n do a clean install before it actually work.
thanks !
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on April 19, 2007, 09:59:46 pm
o_0. Thats very odd. Sorry about that. I have no idea what would be causeing the duplicate code.

Pet categories can probably come when I actually create an admin pannel. They would be a pain to do before that though.
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: preddy25 on April 20, 2007, 01:00:24 am
hi basil ! thanks for the hacks so far ! i m still playing around with it now  &gt;:D

can anyone tell me how do hack the display template php so i can place the "View Inventory" and "Send money to" beside the user's post with icons instead of text?



I tried a few times but haven been successful yet... i am very noob at coding..help pls?would appreciate it alot!
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Lady Ambrosia on April 20, 2007, 05:10:46 am
o_0. Thats very odd. Sorry about that. I have no idea what would be causeing the duplicate code.

Pet categories can probably come when I actually create an admin pannel. They would be a pain to do before that though.
Oh that's fine, I can wait until then :D  I agree that it would be a pain to them before an admin panel, I guess I should have mentioned that when you started on the admin panel that would be a great time to add the categories LOL sorry about that.  But seriously, I think you're doing an awesome job with this mod, I hope to have my pets made pretty soon, so I can finally add it to my working forum, as I know my members will LOVE this mod!
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on April 23, 2007, 02:35:26 am
Looks like a cleared most of the errors up. It appears they were caused by me not understanding class_exists, and thus using constants when I shouldve quoted.  :D

Anyways... just need to work on upgraded food and starter pets now.  :)
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Lady Ambrosia on April 23, 2007, 05:01:13 am
Looks like a cleared most of the errors up. It appears they were caused by me not understanding class_exists, and thus using constants when I shouldve quoted.  :D

Anyways... just need to work on upgraded food and starter pets now.  :)
:o  That quick already?  REALLY?  WOW!!!  You don't play around do you?  I wasn't expecting you to just have only 2 more things left to do, I was thinking oh this will be a few weeks yet...WOW!!
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on April 23, 2007, 05:12:24 am
Getting the paw was a matter of coping and pasting technodragon's work.

Almost all the errors were because of my class structure, so those were easy to fix as well.  :P
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: dymas88 on April 23, 2007, 03:07:37 pm
Quote
Type     Action     Description
1.    Execute Code    updateScript.php    
2.    Execute Modification    ./Sources/shop/pet_engine.php    File not found
3.    Execute Modification    ./Themes/default/languages/Shop.english.php    Test failed
4.    Execute Modification    ./Sources/shop/Shop-Subs.php    Test failed
5.    Extract File    ./Sources/shop/items/Food.php    

how about this?
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on April 24, 2007, 04:06:08 am
You are trying to instal the upgrade before you install the package itself.  :P :P
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: discoponies on April 26, 2007, 08:24:15 am
I put my pet into training... and since the time it has come out of training I have been given this message when trying to access any part o the shop...

Quote
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'm waiting till i can by a Hero Chao to balance him out...',hunger =' at line 7File: /home/fhlinux172/n/nomoreblue.greenhillnetwork.co.uk/user/htdocs/Sources/shop/pet_engine.phpLine: 298

Any ideas what to fix? Cos Im confused because I have NO idea why it would have issue with the line....

            WHERE pet_id = {$this->id}", __FILE__, __LINE__);

I tried bother versions of the pet engine file (0.0 and 0.1) and it still points out that speficic line with that speciifc code in the file.
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on April 26, 2007, 10:37:04 am
I think it has to do with pet names/descriptions having quote marks in them. I thought I had checked for that, but guess not.
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: discoponies on April 26, 2007, 09:37:49 pm
So If I reinstall it afresh and make sure it is clear that you shouldt use quotations etc... then it will be fine?
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Lady Ambrosia on April 27, 2007, 02:27:44 am
So If I reinstall it afresh and make sure it is clear that you shouldt use quotations etc... then it will be fine?


I think someone said that they had their members change the names or that they changed it themselves, but I can't remember where I saw that, it's somewhere in this thread though.
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on April 27, 2007, 03:52:48 am
The quote error should be fixed with the latest version. Which should be out soon. Right now its just gonna be 0.2 -- no upgrade. So if you want an upgrade you can either manually install or uninstill(backup the pets table first) and reinstall afresh.  ;)

Most of the changes I have wanted to see are already in the 0.2 version. The biggest changes between it and the official release will be coding the admin side of things.  :-X
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: discoponies on April 27, 2007, 07:29:58 am
Well just so everyone knows. I installed the system again. It was because somebody used a ' in their pet description... well I think it was. Because once removed it was fine.

Oh well, very good mod, I have customised to make it about Chao (I run a Sonic fan site), so overall, I like ^^
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Honcho on April 29, 2007, 09:16:43 pm
My pet seems to be stuck in training!
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Jamie on April 30, 2007, 01:47:56 am
Mine did that too.  I had to click the button again to up his training.  As soon as I clicked the button it said it had completed the course.
Title: Re: SMFPets is Finally Here (0.1 out)
Post by: Basil Beard on April 30, 2007, 07:28:24 am
Hey guys... check it out

http://dev.dansoftaustralia.net/frs/shownotes.php?release_id=13

I have made another thread in the proper place for discussing SMFPets.