Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #11  
Old 03-09-2016, 12:49 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 88,402
Kyttias is on a distinguished road
Default

I updated the code above, give it a shot?

I can also try to make an addendum to the family tree code to prevent nonexistent pets from displaying. That'll definitely be easier in the long run, I think. (Actually no, it wasn't, I learned something from HoF in the process.)

Basically, in the family tree code, we need to wrap the offspring in a try/catch statement, so find the foreach loop:
PHP Code:
foreach($offsprings as $offspring){
    if (
$offspring != 0){
        try { 
            
$child = new OwnedAdoptable($offspring);
            
$babies[] = ""# THIS LINE IS JUST REALLY LONG SO I LEFT IT EMPTY, IT'LL HAVE STUFF IN IT
        
} catch (AdoptNotfoundException $anfe) { /* Ignore the error. */}
    }

I hope you can find that/it makes sense. @w@...
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.

Last edited by Kyttias; 03-09-2016 at 02:08 AM.
Reply With Quote
  #12  
Old 03-09-2016, 12:51 PM
tahbikat's Avatar
tahbikat tahbikat is offline
Member
 
Join Date: Feb 2014
Location: Louisiana
Posts: 408
Gender: Female
Credits: 49,662
tahbikat is on a distinguished road
Default

Thank you so much Kyttias! I'm going to test it out later when I get home (:
Reply With Quote
  #13  
Old 03-09-2016, 05:14 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 88,402
Kyttias is on a distinguished road
Default

I'm now using code from both post #9 and post #11 just to be safe. While I was discussing this with HoF he expressed some of the same concerns I had, however, so it's worth bringing up:

We don't really know if other side effects will exist. I can't immediately fathom any, but that doesn't mean they don't exist. What if a pet is deleted half way through a trade? Will it corrupt the trade section for one person, both people, everyone? And, is it possible to to keep the pet's profile open, release it to the pound, and because you still have your pet's page open as if you own it - delete it? Would that break the pound? I haven't fully considered these things so please do some testing.

It's hard to officially approve of deleting pets when we don't know what could happen.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.
Reply With Quote
  #14  
Old 03-09-2016, 10:26 PM
tahbikat's Avatar
tahbikat tahbikat is offline
Member
 
Join Date: Feb 2014
Location: Louisiana
Posts: 408
Gender: Female
Credits: 49,662
tahbikat is on a distinguished road
Default

Hmm, alright. I think I'll try getting a tester site up and do testing before releasing this on my site then. Those are some valid points made and could definitely turn into an issue if anyone were to abuse it.

EDIT: Alternatively, perhaps I can instead just make a page just like the pound and allow users to "release" their pets there, clearing any family data, and every few days the pets can be automatically (or manually) deleted thereafter. Pets on this page wouldn't be allowed for readoption.

Last edited by tahbikat; 03-09-2016 at 11:47 PM.
Reply With Quote
  #15  
Old 03-16-2016, 02:52 AM
tahbikat's Avatar
tahbikat tahbikat is offline
Member
 
Join Date: Feb 2014
Location: Louisiana
Posts: 408
Gender: Female
Credits: 49,662
tahbikat is on a distinguished road
Default

Alright so coming back to this. :P The code that ignores the error when an offspring doesn't exist is working great. Is there a way to have this also work if mothers and fathers were deleted as well? Whenever a mother or father is deleted, the babies get an error on their pages saying so. I tried to look in the code and figure it out myself but not getting anywhere. ><
Reply With Quote
  #16  
Old 03-16-2016, 04:39 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 88,402
Kyttias is on a distinguished road
Default

I'll work on this when I get back from... work. *sigh*

edit: See later post for solution.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.

Last edited by Kyttias; 03-16-2016 at 02:07 PM.
Reply With Quote
  #17  
Old 03-16-2016, 12:28 PM
tahbikat's Avatar
tahbikat tahbikat is offline
Member
 
Join Date: Feb 2014
Location: Louisiana
Posts: 408
Gender: Female
Credits: 49,662
tahbikat is on a distinguished road
Default

Ahh Kyttias thank you! <3 It's no rush. I just happened to fiddle with it more and noticed that problem unfortunately.

I'm not using grandparents on my site at the moment so it wouldn't be a problem for me luckily, though others following this might find that useful. Not sure if I ever will display grandparents, so I'm mainly just focused on ignoring the error for parents as well. I also still need to do some testing to make sure there aren't any major errors with adding the deleting part. Plan on getting to that soon!
Reply With Quote
  #18  
Old 03-16-2016, 02:53 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 88,402
Kyttias is on a distinguished road
Default

The best thing to do will be just to make a try/catch as we did before, actually, with the children. Telling you where to make edits is a little harder, so, from the thread where the family tree was made, post number four, the first bit of code. That. Where-ever you put that, no matter how you designed it within, it'll be easiest just to put this above it, so we have both:

PHP Code:
if ($adopt->mother != NULL){ try { $mother = new OwnedAdoptable($adopt->mother); } catch (AdoptNotfoundException $anfe){ $adopt->mother NULL; } }
if (
$adopt->father != NULL){ try { $father = new OwnedAdoptable($adopt->father); } catch (AdoptNotfoundException $anfe){ $adopt->father NULL; } }
if (
$adopt->grandmotherA != NULL){ try { $grandmotherA = new OwnedAdoptable($adopt->grandmotherA); } catch (AdoptNotfoundException $anfe){ $adopt->grandmotherA NULL; } }
if (
$adopt->grandmotherB != NULL){ try { $grandmotherB = new OwnedAdoptable($adopt->grandmotherB); } catch (AdoptNotfoundException $anfe){ $adopt->grandmotherB NULL; } }
if (
$adopt->grandfatherA != NULL){ try { $grandfatherA = new OwnedAdoptable($adopt->grandfatherA); } catch (AdoptNotfoundException $anfe){ $adopt->grandfatherA NULL; } }
if (
$adopt->grandfatherB != NULL){ try { $grandfatherB = new OwnedAdoptable($adopt->grandfatherB); } catch (AdoptNotfoundException $anfe){ $adopt->grandfatherB NULL; } } 
And you may not need the grandparent bits, of course.

So why do we need this code first?

Basically, the code from the post I referred to is checking whether or not the current adoptable has a parent held in its database column (it's checking for NULL, so, so long as something there, it should try to render something). Well, we're backing up a step. First we're checking if the field is not NULL - okay, something is there? Okay, but does that pet actually exist? We check that. And if doesn't exist? We inform the code it is NULL, therefore stopping the original code.

If something about this goes strangely, go ahead and send me the file via PM.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.
Reply With Quote
  #19  
Old 03-16-2016, 03:22 PM
tahbikat's Avatar
tahbikat tahbikat is offline
Member
 
Join Date: Feb 2014
Location: Louisiana
Posts: 408
Gender: Female
Credits: 49,662
tahbikat is on a distinguished road
Default

You really are the best! <3 It works, at least for mothers and fathers. Someone else would need to test grandparents. :P Thank yoouuu!
Reply With Quote
  #20  
Old 03-20-2016, 06:55 PM
tahbikat's Avatar
tahbikat tahbikat is offline
Member
 
Join Date: Feb 2014
Location: Louisiana
Posts: 408
Gender: Female
Credits: 49,662
tahbikat is on a distinguished road
Default

Still haven't tested if deleting adopts causes any errors, but did wanna say I instead just basically duplicated the pound and made it into the "Wild". Players can't adopt these pets but they can view them and their profiles. So far it seems to be working okay and I may just stick to this. I need to trim and clean up a lot of the code though.

Also working on getting pets to display randomly and limited to only maybe 50 or so at a time. Would be horrible to visit a page with 500+ pets there. :P

I'm also not sure if I wanna delete pets manually every so often (for tidyness), or just keep them there. Probably just gonna get my users to vote on this.

Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 10:21 AM.

Currently Active Users: 9702 (0 members and 9702 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636