Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Addons and Modifications > Mys v1.3.x Mods

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 03-16-2013, 08:37 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: 488,518
Hall of Famer is on a distinguished road
Default Gender Ratio Mod for Mys v1.3.3

Now that Mys v1.3.3 has been released, it is about time for me to update my old addons/plugins to be compatible with the new version. The first Mod I have converted is this gender ratio Mod, whose process took me just about half an hour. I've included an rar file at the end of this post for you to download the files, make sure to enter the directory /install and execute the file /install/genderratio.php so that the column genderratio will be inserted successfully into the database.

Incase you cannot use the default files I have provided for some reason, I am writing a simple guide for manual installation of this Mod. It is quite easy, and requires less script edits than the older version.


Anyway, to begin with, insert the column genderratio into your table prefix.adoptables. Its type is INT, default value should be 50:

PHP Code:
'genderratio'INT11 ), default 50 
After this is done, go to your script file /admincp/adopt.php, and find the following code:

PHP Code:
        $adoptForm->add($basicInfo);
        
$adoptForm->add($shopSettings);
        
$adoptForm->add($conditions);
        
$adoptForm->add($miscellaneous);
        
$adoptForm->add(new Button("Create this Adoptable""submit""submit"));
        
$document->add($adoptForm); 
Add above:(it actually does not matter if you mistakenly inserted these lines below instead, thats the beauty of OOP and GUI!)
PHP Code:
        $miscellaneous->add(new Comment("The Gender Ratio of your adoptable is "FALSE));
        
$miscellaneous->add(new TextField("genderratio"50)); 
Before closing this file, find the sql insertion query for prefix.adoptables at:
PHP Code:
            $mysidia->db->insert("adoptables", array("id" => NULL"type" => $mysidia->input->post("type"), "class" => $mysidia->input->post("class"), "description" => $mysidia->input->post("description"), "eggimage" => $eggimage"whenisavail" => $mysidia->input->post("cba"),
                                                     
"alternates" => $mysidia->input->post("alternates"), "altoutlevel" => $mysidia->input->post("altoutlevel"), "altchance" => $mysidia->input->post("altchance"), "shop" => $mysidia->input->post("shop"), "cost" => $mysidia->input->post("cost"))); 
Replace this chunk of code with:
PHP Code:
            $mysidia->db->insert("adoptables", array("id" => NULL"type" => $mysidia->input->post("type"), "class" => $mysidia->input->post("class"), "description" => $mysidia->input->post("description"), "eggimage" => $eggimage"whenisavail" => $mysidia->input->post("cba"),
                                                     
"alternates" => $mysidia->input->post("alternates"), "altoutlevel" => $mysidia->input->post("altoutlevel"), "altchance" => $mysidia->input->post("altchance"), "shop" => $mysidia->input->post("shop"), "cost" => $mysidia->input->post("cost"), "genderratio" => $mysidia->input->post("genderratio"))); 
You may now close this /admincp/adopt.php file. The very next thing to do is to open a file located at /classes/class_adoptable.php. First of all, find a list of properties for this class at:
PHP Code:
    protected $id;
    protected 
$type;
    protected 
$class;
    protected 
$description;
    protected 
$eggimage;
    protected 
$whenisavail;
    protected 
$alternates;
    protected 
$altoutlevel;
    protected 
$altchance;
    protected 
$shop;
    protected 
$cost;  
    protected 
$conditions;
    protected 
$levels
Replace by:
PHP Code:
    protected $id;
    protected 
$type;
    protected 
$class;
    protected 
$description;
    protected 
$eggimage;
    protected 
$whenisavail;
    protected 
$alternates;
    protected 
$altoutlevel;
    protected 
$altchance;
    protected 
$shop;
    protected 
$cost;  
    protected 
$genderratio;
    protected 
$conditions;
    protected 
$levels
Perfect, we only have one last thing to do before this is all completed. Find the gender determination code at:
PHP Code:
    public function getGender(){
        
$genders = array('f''m');
        
$rand rand(0,1);
        return 
$genders[$rand];
    } 
Replace by:
PHP Code:
    public function getGenderRatio(){
        return 
$this->genderratio;
    }
    
    public function 
getGender(){        
        
$genderNumber rand(099);
        if(
$genderNumber $this->genderratio$gender "f";
        else 
$gender "m";
        return 
$gender;        
    } 
This is a reusable method, which means that both adopt.php and breeding.php can make use of it without writing the same block of code twice. Another reason why OOP pwns.


So this marks the end of manual installation process, its a lot simpler than last time isnt it? Anyway I hope you enjoy the Mods I am making for the script, I've decided to work on a few more new plugins for the script in the next few days. Lemme know if you have any suggestions to make, please do lemme know.
Attached Files
File Type: rar gender ratio mod v1.3.3.rar (5.8 KB, 17 views)
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #2  
Old 05-07-2013, 11:39 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 96,910
SilverDragonTears is on a distinguished road
Default

When I run it I get a blank screen.
__________________

Check out SilvaTales
Reply With Quote
  #3  
Old 05-08-2013, 12:06 AM
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: 488,518
Hall of Famer is on a distinguished road
Default

Blank page? Well there is a syntax error somewhere in your script then. Did you download the files I attached, or did the manual installation?
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #4  
Old 05-08-2013, 01:49 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 96,910
SilverDragonTears is on a distinguished road
Default

I downloaded the files.
__________________

Check out SilvaTales
Reply With Quote
  #5  
Old 06-02-2013, 04:11 AM
Alaric Alaric is offline
Mod
 
Join Date: Nov 2011
Posts: 112
Gender: Male
Credits: 315,042
Alaric is on a distinguished road
Default

Is this correct?

__________________
Reply With Quote
  #6  
Old 06-14-2013, 10:54 AM
Tequila's Avatar
Tequila Tequila is offline
The Grim One
 
Join Date: Jan 2009
Location: Souther Tier, New York State
Posts: 1,356
Gender: Female
Credits: 109,666
Tequila is on a distinguished road
Default

I just installed this on a test site (theory site) and got this when I created an adoptable for it:
Quote:
Fatal error: Uncaught exception 'Exception' with message 'Database error 1054 - Unknown column 'genderratio' in 'field list'' in /home/felinefl/public_html/classes/class_database.php:161 Stack trace: #0 /home/felinefl/public_html/classes/class_database.php(54): Database->_query('adoptables', Array, 'insert') #1 /home/felinefl/public_html/admincp/adopt.php(65): Database->insert('adoptables', Array) #2 /home/felinefl/public_html/admincp/index.php(71): ACPAdoptController->add() #3 /home/felinefl/public_html/admincp/index.php(125): AdminCP->handleRequest() #4 /home/felinefl/public_html/admincp/index.php(135): AdminCP::main() #5 {main} thrown in /home/felinefl/public_html/classes/class_database.php on line 161
__________________
Artist. Designer. Gamer. Mother.
[portfolio] [tarot] [Rune Hollow] [freebies]
Reply With Quote
  #7  
Old 06-16-2013, 01:06 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: 488,518
Hall of Famer is on a distinguished road
Default

Oh yeah Tequila my dear, you forgot to add a database column into your table prefix.adoptables. XD
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #8  
Old 06-16-2013, 04:00 PM
Tequila's Avatar
Tequila Tequila is offline
The Grim One
 
Join Date: Jan 2009
Location: Souther Tier, New York State
Posts: 1,356
Gender: Female
Credits: 109,666
Tequila is on a distinguished road
Default

*smacks forehead* ...

Edit I typed the column name wrong.... ╯.╰
__________________
Artist. Designer. Gamer. Mother.
[portfolio] [tarot] [Rune Hollow] [freebies]

Last edited by Tequila; 06-16-2013 at 07:26 PM.
Reply With Quote
  #9  
Old 06-17-2013, 03:22 AM
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: 488,518
Hall of Famer is on a distinguished road
Default

Oh I see, so thats the problem. XD
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #10  
Old 08-22-2013, 04:52 AM
Twinkle And Kessie Twinkle And Kessie is offline
Member
 
Join Date: May 2013
Location: South East Alaska.
Posts: 3
Gender: Female
Credits: 1,206
Twinkle And Kessie is on a distinguished road
Default

Either "table prefex.adoptables" is really hard to find, or was deleted completely from my system some how. What is a Table Prefix supposed to be anyway!? The instructions are very unclear and vague, there's no specifics that help newbies like me learn what exactly we're doing. I'll have to manually learn php just to figure out what every little insignificant thing means.

I did exactly as it said step for step, and when I try to create a new adoptable or edit one of the ones I have already, I get a blank white screen. There's not even an Error Message, just a blank screen.

Wait, lemme figure this out on my own, I think I got it now.

No... I redid everything, and it still doesn't work, it's still a blank white screen. This is frustrating. :P

Last edited by Twinkle And Kessie; 08-22-2013 at 05:42 AM. Reason: Keep trying, still not working, adding as much info I can
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
Mys v1.3.4 Gender Ratio Mod for Mys v1.3.4 Hall of Famer Mys v1.3.x Mods 14 06-17-2020 08:20 PM
Mys v1.3.2 Gender Ratio Mod for Mys v1.3.2 Hall of Famer Mys v1.3.x Mods 6 01-08-2013 03:02 PM
Mys v1.3.1 Gender Ratio Mod for v1.3.1 Hall of Famer Mys v1.3.x Mods 15 08-17-2012 04:25 AM
Hall of Famer's Gender Ratio Mod v1.2 Hall of Famer Mys v1.2.x Mods 45 04-02-2012 01:42 PM
gender ratio script maximillion Questions and Supports 16 06-27-2011 12:59 PM


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

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