Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Active pet widget? (http://www.mysidiaadoptables.com/forum/showthread.php?t=5064)

Ittermat 03-08-2016 12:15 PM

Yes automatically getting the items and money is fine! Also no need to worry about 2 right now..maybe later? And 3 ill mess with lol. As for status effects is it possible to give me bases for what different things can be done? Id like the effects to do things to them, and if possible have the pet say something like if they gain am item or lose money or something? But im unsure what i want the status effects to say lol..ill think more on it and use what you gave me when i get home from work ^_^

Also thank you again you are amazing!

_______

EDIT EDIT:

Heres some ideas for status effects.. if you give me the base coding to use I can modify from there for these. (like have it set the effects- but allow me to change what it says and add more of them to it you know?)

Status effects:


-Looks like ( Petname) found a some food! They've gained some exp! (Gains Clicks)

- (petname) Ate some garbage! Gross!

-Oh no! (Petname) has been cursed! (Clicks reset for day)

-They grow up so fast dont they? Lets fix that! (petname) is now a baby again! (reverts to baby stage)

-(petname) Won a fight! They gained a level! (gains one level)

-The love fairy came by and waved her wand! (petname) can now breed again! (enables breeding again)

-A mad scientist is loose! (Petname) no longer has species barriers when being bred! (Enables cross species breeding)

-----



Edit: Where do I put this code in at btw?

Hall of Famer 03-09-2016 06:07 PM

Well when debugging your site, I find that it has a very serious glitch resulted from this Active Pet Module. For a newly registered user, they do not own any adoptable yet, and therefore do not have favorite pet. However, the script assumes that this new user has favorite pet, and try to fetch the adoptable ID 0 instead(favorite pet ID defaults to 0 if it does not exist). This leads to an uncaught exception 'adoptable ID does not exist', and will prevent any newly registered users from browsing your site.

To fix this, you need to take care of the scenario in which the user has no favorite pet(ID = 0). In this case, you will either just not fetch adoptable at all, or catch exception using a try...catch block. The choice is up to you.


Edit: Strangely the solution Kyttias offered seems to have taken care of nonexistent favorite pet ID already, but when I dont have a favorite pet I still receive errors. Did you copy/paste her code exactly? Or something else is wrong?

Ittermat 03-09-2016 06:31 PM

I copy pasted..the first code she put up- but i havent done anything with her second one since Im not sure exactly where to put it.

Kyttias 03-09-2016 06:34 PM

The code (with all the percent discussion) isn't done yet/doesn't do anything yet. It'll go inside the setFavPetSB() we made, inside the else half of the if statement, all this inside class_sidebar.php.

:happyc: Sorry, I've had along day and don't think I can work on this tonight - good news is that I don't have work again until at least Sunday so I'll have a few days to think on all of this.

edit - @HoF, I vaguely remember this issue but I'm not sure how it was resolved. =/

Ittermat 03-09-2016 06:35 PM

no its fine kyttias! I know you have a life... Im sorry to be so bothersome..Im seriously bad at this coding thing...I am trying to learn though honest...its just not clicking or sticking..

Ittermat 03-10-2016 02:44 PM

I tried to fix the error- but couldnt so for now I just removed the active pet widget until we can figure out how to fix that problem XD

Ittermat 03-20-2016 12:33 PM

Did we ever figure out how to fix this?

I even made an adoptable to put in its place-when one has no favorite pet

http://i63.tinypic.com/1zc0c50.jpg

The Adoptable id (in adopt_Adoptables table) is 30

if that helps any?

Kyttias 03-20-2016 02:03 PM

Actually the above won't work because if the user doesn't own pet 30 it might cause errors.

Send me the code we put in classes/class_sidebar.php - I'd like to make some changes to it.

PHP Code:

protected function setFavPetSB(){
    
$mysidia Registry::get("mysidia");
    
$profile $mysidia->user->getprofile();
    
    if (
$this->userfavpet == "0"){
        
$this->FavPetSB = new Paragraph
        
$this->FavPetSB->add(new Comment("<b>No Favorite Pet Set</b>"));
    }

    if (
$profile->getFavpetID() != "0"){
        
$favpet = new OwnedAdoptable($profile->getFavpetID());
        
$this->FavPetSB = new Paragraph
        
$this->FavPetSB->add(new Comment("<b>Favorite Pet!</b> <br/>
            <a href='/myadopts/manage/
{$favpet}'><img src='{$favpet->getImage()}'></a>
            "
));
    }

    
$this->setDivision($this->FavPetSB);


I'm changing where we get information from, basically. And then we're more closely checking only if its zero or not zero. If it's empty, at least it won't error.

If you're afraid of editting the code, I can do it.

Ittermat 03-20-2016 02:07 PM

all of the coding you gave me is on the first page.. 0.o....I havent done anything to it..
Also im not sure how I would edit it... XD

Kyttias 03-20-2016 02:25 PM

If you haven't done anything to it then you should be able to just replace it.


All times are GMT -5. The time now is 11:43 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.