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 04-25-2017, 07:52 PM
aquapyrofan aquapyrofan is offline
Member
 
Join Date: Apr 2017
Posts: 48
Gender: Unknown/Other
Credits: 8,647
aquapyrofan is on a distinguished road
Default Pet personalities?

Is there a way I could give pets a randomly generated personality on creation? And maybe have it display a bit of text related to that on the profile(assuming I can get one set up)/on the stats page?
Reply With Quote
  #2  
Old 04-25-2017, 08:18 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 118,265
Abronsyth is on a distinguished road
Default

Oh lords, I just typed out a bunch of information for you and the internet glitched and ate my entire post.

Okay, I'll edit this post in a moment, just adding the codes that you'll need at the moment.


Edit:

You will need to create two new files, one where the base files for your site are (adopt.php, account.php, etc):

personality.php
PHP Code:
<?php

class PersonalityController extends AppController{

    public function 
index(){
        
$mysidia Registry::get("mysidia");        
    }

}
?>
...and one in the view folder:

personalityview.php
PHP Code:
<?php 

use Resource\Native\String
use 
Resource\Collection\LinkedList

class 
PersonalityView extends View
     
    public function 
index(){ 
        
$mysidia Registry::get("mysidia"); 
        
$document $this->document;         
        
$document->setTitle("New Personality Trait"); 
        
    if(
$mysidia->input->post("add")){
        
$mysidia->db->insert("personalities", array("id" => NULL"pers" => $mysidia->input->post("type")));                
        
$document->add(new Comment"You have added the personality type {$mysidia->input->post("type")}.")); 
        
$document->add(new Comment("<meta http-equiv='refresh' content='1;url=personality' />")); 
        return 
TRUE;        
    }
            
        if(
$mysidia->user instanceof Admin){ 
        
$adoptablepersonality $mysidia->db->select("personalities", array("pers"), "1 ORDER BY RAND() DESC LIMIT 1")->fetchColumn();
        
$document->add(new Comment"<h2>Add New Personality Types</h2>")); 
             
$document->add(new Comment"Adding new possible personality types is easy! Just type it in the box and hit submit, then new adoptables have a chance of ending up with that personality type.<br><br>{$adoptablepersonality}<br><br>")); 
         
        
$persForm = new Form("addform""""post");
        
$persForm->add(new Comment("<br><u>Create A New Personality:</u><br>"TRUE"b"));
        
$persForm->add(new Comment("Type:"));
        
$persForm->add(new TextField("type"));
        
$persForm->add(new Button("Add""add""submit"));
        
$document->add($persForm);    
                     
                     
$document->add(new Comment"<hr>"));
        }
                else{ 
$document->add(new Comment"You do not have permission to access this page.")); 
}
          
        
            
            
     }
     
}
?>
With that done we need to go into the database and add one new table to the database called adopts_personalities with two columns. The two columns will need this data entered:
name: id
type: int(20)
null: No
default: None
extra: AUTO_INCREMENT

name: pers
type: varchar(100)
collation: latin1_swedish_ci
null: Yes
default: Null

Now move on over to owned_adoptables and add a new column with the following info:
name: personality
type: varchar(100)
collation: latin1_swedish_ci
null: No
default: Easy Going

Now for the tedious part. You will need to make the same edits, more or less, to the following five files:
adopt.php
classes/class_breeding.php
classes/class_promocode.php
classes/class_stockadopt.php
admincp/ownedadopt.php

Find the insert line in each file that starts like this:
$mysidia->db->insert("owned_adoptables", array("aid" => NULL...

At the end of that, before the closing )); add a comma behind whatever is last, and then add this:
PHP Code:
"personality" => $adoptablepersonality 
__________________
My Mods Site (1.3.4, 2020 Mods)

Last edited by Abronsyth; 04-25-2017 at 08:38 PM.
Reply With Quote
  #3  
Old 04-25-2017, 09:57 PM
aquapyrofan aquapyrofan is offline
Member
 
Join Date: Apr 2017
Posts: 48
Gender: Unknown/Other
Credits: 8,647
aquapyrofan is on a distinguished road
Default

Quote:
Originally Posted by Abronsyth View Post
Oh lords, I just typed out a bunch of information for you and the internet glitched and ate my entire post.

Okay, I'll edit this post in a moment, just adding the codes that you'll need at the moment.


Edit:

You will need to create two new files, one where the base files for your site are (adopt.php, account.php, etc):

personality.php
PHP Code:
<?php

class PersonalityController extends AppController{

    public function 
index(){
        
$mysidia Registry::get("mysidia");        
    }

}
?>
...and one in the view folder:

personalityview.php
PHP Code:
<?php 

use Resource\Native\String
use 
Resource\Collection\LinkedList

class 
PersonalityView extends View
     
    public function 
index(){ 
        
$mysidia Registry::get("mysidia"); 
        
$document $this->document;         
        
$document->setTitle("New Personality Trait"); 
        
    if(
$mysidia->input->post("add")){
        
$mysidia->db->insert("personalities", array("id" => NULL"pers" => $mysidia->input->post("type")));                
        
$document->add(new Comment"You have added the personality type {$mysidia->input->post("type")}.")); 
        
$document->add(new Comment("<meta http-equiv='refresh' content='1;url=personality' />")); 
        return 
TRUE;        
    }
            
        if(
$mysidia->user instanceof Admin){ 
        
$adoptablepersonality $mysidia->db->select("personalities", array("pers"), "1 ORDER BY RAND() DESC LIMIT 1")->fetchColumn();
        
$document->add(new Comment"<h2>Add New Personality Types</h2>")); 
             
$document->add(new Comment"Adding new possible personality types is easy! Just type it in the box and hit submit, then new adoptables have a chance of ending up with that personality type.<br><br>{$adoptablepersonality}<br><br>")); 
         
        
$persForm = new Form("addform""""post");
        
$persForm->add(new Comment("<br><u>Create A New Personality:</u><br>"TRUE"b"));
        
$persForm->add(new Comment("Type:"));
        
$persForm->add(new TextField("type"));
        
$persForm->add(new Button("Add""add""submit"));
        
$document->add($persForm);    
                     
                     
$document->add(new Comment"<hr>"));
        }
                else{ 
$document->add(new Comment"You do not have permission to access this page.")); 
}
          
        
            
            
     }
     
}
?>
With that done we need to go into the database and add one new table to the database called adopts_personalities with two columns. The two columns will need this data entered:
name: id
type: int(20)
null: No
default: None
extra: AUTO_INCREMENT

name: pers
type: varchar(100)
collation: latin1_swedish_ci
null: Yes
default: Null

Now move on over to owned_adoptables and add a new column with the following info:
name: personality
type: varchar(100)
collation: latin1_swedish_ci
null: No
default: Easy Going

Now for the tedious part. You will need to make the same edits, more or less, to the following five files:
adopt.php
classes/class_breeding.php
classes/class_promocode.php
classes/class_stockadopt.php
admincp/ownedadopt.php

Find the insert line in each file that starts like this:
$mysidia->db->insert("owned_adoptables", array("aid" => NULL...

At the end of that, before the closing )); add a comma behind whatever is last, and then add this:
PHP Code:
"personality" => $adoptablepersonality 
So all that's in, now how do I get to the add personality page and how do I view a pet's personality?
Reply With Quote
  #4  
Old 04-26-2017, 09:02 AM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 118,265
Abronsyth is on a distinguished road
Default

Sorry, internet shorted out again before I could finish @_@

Okay, here are the rest of the instructions:

In the same 5 files I mentioned, find the insert line again, and right above it add this line;
PHP Code:
$adoptablepersonality $mysidia->db->select("personalities", array("pers"), "1 ORDER BY RAND() DESC LIMIT 1")->fetchColumn(); 
To display a pet's personality on, say, the manage page (via myadoptsview.php) you can use this:
PHP Code:
{$adopt->personality
In some files you'll just need to change that to this;
PHP Code:
{$this->adopt->personality
Then you can access the add page at http://YOURSITE.com/personality (don't worry, only admins can access it!)

And that should be it!
__________________
My Mods Site (1.3.4, 2020 Mods)

Last edited by Abronsyth; 04-26-2017 at 10:13 AM.
Reply With Quote
  #5  
Old 04-26-2017, 03:18 PM
KatFennec's Avatar
KatFennec KatFennec is offline
Member
 
Join Date: Apr 2017
Posts: 57
Gender: Female
Credits: 8,126
KatFennec is on a distinguished road
Default

I probably screwed something up, but my site returns a 500 error when I try to access mysite/personality
Reply With Quote
  #6  
Old 04-26-2017, 04:11 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 118,265
Abronsyth is on a distinguished road
Default

Did you edit anything in the files at all?

Make sure everything's in the right folder?
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #7  
Old 04-26-2017, 06:33 PM
KatFennec's Avatar
KatFennec KatFennec is offline
Member
 
Join Date: Apr 2017
Posts: 57
Gender: Female
Credits: 8,126
KatFennec is on a distinguished road
Default

The only edits I made are the ones you said to make, and I double checked the positions, so I'm pretty sure that's not it
Reply With Quote
  #8  
Old 04-27-2017, 08:31 AM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 118,265
Abronsyth is on a distinguished road
Default

Alright, could you show me the sections in the 5 files that have been edited? (adopt.php, class_breeding.php, class_promocode.php, class_stockadopt.php, and admincp/ownedadopt.php)

Edit:
Before doing that, try adding this about the index function in personality.php:
PHP Code:
public function __construct(){
parent::__construct("member");    

And let me know if you see any changes.
__________________
My Mods Site (1.3.4, 2020 Mods)

Last edited by Abronsyth; 04-27-2017 at 08:33 AM.
Reply With Quote
  #9  
Old 04-27-2017, 01:52 PM
KatFennec's Avatar
KatFennec KatFennec is offline
Member
 
Join Date: Apr 2017
Posts: 57
Gender: Female
Credits: 8,126
KatFennec is on a distinguished road
Default

adopt.php
PHP Code:
$adoptablepersonality $mysidia->db->select("personalities", array("pers"), "1 ORDER BY RAND() DESC LIMIT 1")->fetchColumn();
            
$mysidia->db->insert("owned_adoptables", array("aid" => NULL"type" => $adopt->getType(), "name" => $name"owner" => $mysidia->user->username"currentlevel" => 0"totalclicks" => 0"code" => $code
                                                           
"imageurl" => NULL"usealternates" => $alts"tradestatus" => 'fortrade'"isfrozen" => 'no'"gender" => $gender"offsprings" => 0"lastbred" => 0"personality" => $adoptablepersonality)); 
class_breeding.php
PHP Code:
$adoptablepersonality $mysidia->db->select("personalities", array("pers"), "1 ORDER BY RAND() DESC LIMIT 1")->fetchColumn();
            
$mysidia->db->insert("owned_adoptables", array("aid" => NULL"type" => $adopt->getType(), "name" => $adopt->getType(), "owner" => $mysidia->user->username"currentlevel" => 0"totalclicks" => 0"code" => $code
                                                           
"imageurl" => NULL"usealternates" => $alts"tradestatus" => 'fortrade'"isfrozen" => 'no'"gender" => $gender"offsprings" => 0"lastbred" => 0"personality" => $adoptablepersonality)); 
class_promocode.php
PHP Code:
$adoptablepersonality $mysidia->db->select("personalities", array("pers"), "1 ORDER BY RAND() DESC LIMIT 1")->fetchColumn();
            
$mysidia->db->insert("owned_adoptables", array("aid" => NULL"type" => $this->reward"name" => $this->reward"owner" => $this->user"currentlevel" => 0"totalclicks" => 0"code" => $code
                                                           
"imageurl" => NULL"usealternates" => 'no'"tradestatus" => 'fortrade'"isfrozen" => 'no'"gender" => $genders[$rand], "lastbred" => 0"personality" => $adoptablepersonality)); 
class_stockadopt.php
PHP Code:
$adoptablepersonality $mysidia->db->select("personalities", array("pers"), "1 ORDER BY RAND() DESC LIMIT 1")->fetchColumn();
      
$mysidia->db->insert("owned_adoptables", array("aid" => NULL"type" => $this->type"name" => $this->type"owner" => $this->owner,
                                                     
"currentlevel" => 0"totalclicks" => 0"code" => $code"imageurl" => """usealternates" => $alts
                                                     
"tradestatus" => "fortrade""isfrozen" => "no""gender" => $genders[$rand],
                                                     
"offsprings" => 0"lastbred" => 0"personality" => $adoptablepersonality)); 
ownedadopt.php
PHP Code:
$adoptablepersonality $mysidia->db->select("personalities", array("pers"), "1 ORDER BY RAND() DESC LIMIT 1")->fetchColumn();
            
$mysidia->db->insert("owned_adoptables", array("aid" => NULL"type" => $mysidia->input->post("type"), "name" => $mysidia->input->post("name"), "owner" => $mysidia->input->post("owner"), "currentlevel" => $mysidia->input->post("level"), "totalclicks" => $mysidia->input->post("clicks"), 
                                                           
"code" => codegen(100), "imageurl" => NULL"usealternates" => $useAlternates"tradestatus" => 'fortrade'"isfrozen" => 'no'"gender" => $mysidia->input->post("gender"), "offsprings" => 0"lastbred" => 0"personality" => $adoptablepersonality)); 
Reply With Quote
  #10  
Old 04-27-2017, 02:47 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 118,265
Abronsyth is on a distinguished road
Default

I posted a snippet of code above, could you try that and let me know the results?
__________________
My Mods Site (1.3.4, 2020 Mods)
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:45 AM.

Currently Active Users: 888 (0 members and 888 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