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
  #1  
Old 08-21-2013, 12:49 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: 657,134
Hall of Famer is on a distinguished road
Default

I guess my post was a bit misleading, I was merely referring to the source code of the very item function you created, not the source code of the entire functions_items.php file. For this case it is not a problem, but at some circumstances it may be time consuming to read through an entire script file. Id say just post the code that aint working is sufficient when bringing up a problem.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #2  
Old 08-21-2013, 04:35 PM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 70,765
Hwona is on a distinguished road
Default Re

Ah. I see! xP
Well, in that case, here's the code! :D

PHP Code:
function items_genderf($item$adopt){
        
$mysidia Registry:: get("mysidia");
        
//Let's check if the adoptable is already female.
        
$gender $mysidia -> db -> select ("owned_adoptables", array("gender"), "aid='{$adopt->aid}' and owner ='{$item->owner}'") -> fetchColumn();  
        if(
$gender == "f") {
            
//The adoptable is already female
            
$note "Your adoptable is already female.";
        }
        else{
            
//The adoptable is male. It's gender can be switched to female.
            
switch($adopt->gender){
                case 
"f":
                    
$mysidia -> db -> update("owned_adoptables", array("gender" => 'f'),"aid='{$adopt->aid}' and owner ='{$item->owner}'");
                    
$note "Your adoptable {$adopt->name} is now female.";
            }
            
//Update item quantity...
            
$delitem $item->remove();
        }
        return 
$note;
        } 
Edit: O.o Thank you guys sooooooo much! - It works! :D

Here's the finished code :D:
PHP Code:
function items_genderf($item$adopt){
        
$mysidia Registry:: get("mysidia");
        
//Let's check if the adoptable is already female.
        
$gender $mysidia -> db -> select ("owned_adoptables", array("gender"), "aid='{$adopt->aid}' and owner ='{$item->owner}'") -> fetchColumn();  
        if(
$gender == "f") {
            
//The adoptable is already female
            
$note "Your adoptable is already female.";
        }
        else{
            
//The adoptable is male. It's gender can be switched to female.
            
switch($adopt->gender){
                case 
"m":
                    
$mysidia -> db -> update("owned_adoptables", array("gender" => 'f'),"aid='{$adopt->aid}' and owner ='{$item->owner}'");
                    
$note "Your adoptable {$adopt->name} is now female.";
            }
            
//Update item quantity...
            
$delitem $item->remove();
        }
        return 
$note;
        } 
__________________

Last edited by Hwona; 08-21-2013 at 04:48 PM.
Reply With Quote
  #3  
Old 08-21-2013, 04:40 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 23,176
IntoRain is on a distinguished road
Default

I already explained why it wasn't working, see the post above Hall Of Famer's. Your switch case is wrong

case "f":
....

^ The switch-case only does the code (update thingy) you have after it if your adopt's gender is female. So it will only change the gender from female to female. You need to change it to case "m".

Last edited by IntoRain; 08-21-2013 at 05:12 PM.
Reply With Quote
  #4  
Old 08-21-2013, 04:51 PM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 70,765
Hwona is on a distinguished road
Default

Yeah, I edited my last post. Anyways, thank you so much! I probably would have kept changing the code and fixing nothing if you didn't point that out. >^.^<
__________________
Reply With Quote
  #5  
Old 08-21-2013, 05:04 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 23,176
IntoRain is on a distinguished road
Default

Quote:
Originally Posted by Wallie987 View Post
Yeah, I edited my last post. Anyways, thank you so much! I probably would have kept changing the code and fixing nothing if you didn't point that out. >^.^<
Yay that's great! :D
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with a item function kristhasirah Questions and Supports 35 04-03-2017 10:17 AM
Mys v1.3.4 Item Function: Gender Change Potion Kyttias Mys v1.3.x Mods 21 10-12-2016 07:52 PM
Calling a function in a function from the same class page Hwona Questions and Supports 2 04-25-2015 08:41 AM
Item Function Suggestions NobodysHero Suggestions and Feature Requests 5 06-23-2014 03:45 AM


All times are GMT -5. The time now is 03:58 AM.

Currently Active Users: 2458 (0 members and 2458 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 - 2025, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636