Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Suggestions and Feature Requests

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 01-12-2017, 11:12 AM
NobodysHero's Avatar
NobodysHero NobodysHero is offline
Co-Owner of MystFell
 
Join Date: Nov 2013
Posts: 144
Gender: Female
Credits: 21,833
NobodysHero is on a distinguished road
Default Making Daycare Optional

One of my players suggested it and I could see why they'd want the option. If they're looking to level their pet once or only to a certain level, then don't get to it once they've hit that level, it could be a problem. Or if they forget to freeze their pets.

So, I was hoping there would be someone awesome enough to doodle up a bit of code and tell me what to add/change in the database to make that happen.

If this code is already floating around out there, can someone aim me in that direction?

Thank you!

NobodysHero
Reply With Quote
  #2  
Old 01-12-2017, 06:26 PM
Dinocanid's Avatar
Dinocanid Dinocanid is offline
Member
 
Join Date: Aug 2016
Location: Maryland, USA
Posts: 516
Gender: Unknown/Other
Credits: 79,311
Dinocanid is on a distinguished road
Default

After looking through the daycare's files, turns out there's actually a pretty short solution that I was able to come up with.

1. First I went into phpMyAdmin, owned_adoptables, and added a new column like this:
Quote:
Name: exclude
Type: VARCHAR
Length: 3
Default: (As Defined) no
Collation: latin1_swedish_ci
Check the null box
2. Now go to class_daycare.php and change line 36 to this (assuming no prior edits were made):
PHP Code:
if(is_numeric($this->settings->level)) $conditions .= " and currentlevel <= '{$this->settings->level}' and exclude = 'no'"
  Spoiler: Sidenote 
Now the daycare won't include any pets that have "exclude" set to yes.


3. Now there's how to update it. This is where my brain started to fry. I'm unsure of this part since most people have their owned_adoptables.php set up differently than others (including myself). Here's one way of doing it:
*Create a new form with two radio buttons, one named "do exclude" and one named "do not exclude" (or something like that).
* Then create an if statement so that if the person selected do exclude, this line happens:
PHP Code:
$mysidia->db->update("owned_adoptables", array("exclude" => 'yes'"username = '{$mysidia->user->username}'"); 
*Create a elseif statement so when the person chooses don't exclude, this line happens:
PHP Code:
$mysidia->db->update("owned_adoptables", array("exclude" => 'no'"username = '{$mysidia->user->username}'"); 
-End guide-

I haven't tested the part where users change it themselves, since I have absolutely no idea how radio buttons work. I have tested the parts before it though, and it does work if you were to change the value manually through phpMyAdmin. Here's a mockup code of the different button conditions, but that's where my knowledge ends unfortunately. It won't work on it's own, but it can give you an idea of what you need to do:
PHP Code:
if($mysidia->input->post("submit")){
$choice $mysidia->input->post("exclude");
if(
$choice == "doexclude"){
$document->add(new Comment("This pet has been excluded from the pound."));
$mysidia->db->update("owned_adoptables", array("exclude" => 'yes'"aid = '{$adopt->getAdoptID()}'");
}
elseif(
$choice == "donotexclude"){
$document->add(new Comment("This pet will now be visible the pound."));
$mysidia->db->update("owned_adoptables", array("exclude" => 'no'"aid = '{$adopt->getAdoptID()}'");
}
return 
TRUE;} 
__________________
Reply With Quote
  #3  
Old 01-13-2017, 12:44 AM
NobodysHero's Avatar
NobodysHero NobodysHero is offline
Co-Owner of MystFell
 
Join Date: Nov 2013
Posts: 144
Gender: Female
Credits: 21,833
NobodysHero is on a distinguished road
Default

I'll have to give this a try. Thanks!
__________________

Venture Into The Mist
Reply With Quote
  #4  
Old 01-13-2017, 03:03 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 492,465
Hall of Famer is on a distinguished road
Default

In Mysidia v1.4.0 and future releases, almost all features are optional, that you can turn on and off from admin control panel, even user registration. For current version v1.3.4, you will need to edit the source file to hide the daycare system.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #5  
Old 01-13-2017, 09:32 PM
NobodysHero's Avatar
NobodysHero NobodysHero is offline
Co-Owner of MystFell
 
Join Date: Nov 2013
Posts: 144
Gender: Female
Credits: 21,833
NobodysHero is on a distinguished road
Default

I don't want to hide it, I want it so some people could opt into it, instead of all pets automatically going into it.

When I was on other sites (Neopets, Restreatu, etc) that had a similar feature, they were more user action than automation. A user would bring their pets to the day care, pay some currency to put them in, then they'd come back to their pet's stats being raised.

What Dino submitted was what I was looking for. About to try it now, though... >.> I've no idea how radios work either. XD Sooo... This should be interesting.
__________________

Venture Into The Mist
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 06:32 PM.

Currently Active Users: 764 (0 members and 764 guests)
Threads: 4,081, Posts: 32,032, 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