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 11-25-2013, 09:56 AM
draugluin's Avatar
draugluin draugluin is offline
Member
 
Join Date: Oct 2011
Location: germany
Posts: 120
Gender: Unknown/Other
Credits: 10,819
draugluin is on a distinguished road
Default Mys 1.3.3 - modify script -

Hi,
I would like to change the script, for example : don't show gender until level 2 ... and others.

But where have I put the text inside the script ?

I've tried it like this (in myadopts .... public function index)

PHP Code:
 $gender = new TCell($adopt->getGender("gui"));
        if(
$currentlevel() == "0" $gender "Egg"); 
but it won't work.

Please help, how can I solve this ?

thank you...
Reply With Quote
  #2  
Old 11-25-2013, 11:18 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: 328,999
Hall of Famer is on a distinguished road
Default

Does it throw an error or anything. Why are you writing code like currentLevel()? There's no such function defined in PHP or Mysidia. Also it's a syntax error to enclose an if statement inside parenthesis, use curly braces instead.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #3  
Old 11-26-2013, 05:55 AM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,309
IntoRain is on a distinguished road
Default

Quote:
Originally Posted by draugluin View Post

PHP Code:
 $gender = new TCell($adopt->getGender("gui"));
        if(
$currentlevel() == "0" $gender "Egg"); 
but it won't work.
It won't work for many reasons.

1) The if works like this:

PHP Code:
if(condition)
{
   do 
this;

2) $currentlevel is a variable, not a function (when you do this something() or something($stuff) or something($stuff, $stuff2) are functions).

3) "0" is a string, you probably want an integer, which is just 0.

4) $currentlevel even as a variable won't work, it's an empty variable. You must have meant $adopt->getCurrentLevel() which is a function that returns the current level of the object $adopt.

5) And this:
PHP Code:
$gender = new TCell($adopt->getGender("gui")) 
Gender is a TCell and below it you are saying it's a string ("Egg"). buildRow only accepts TCells. What you have to do is modify the getGender function so it outputs what you want (either images or strings). That function is associated with $adopt. So you have to see what the variable $adopt is.

PHP Code:
$adopt = new OwnedAdoptable($aid); 
You can see here, $adopt is an object/instance of the class OwnedAdoptable. That means that function is in the class_ownedadoptable file. In that file, you can see you have this variable visible to every function of that class:

PHP Code:
protected $currentlevel
Which can be used with $this->currentlevel.
Then go to the function

PHP Code:
public function getGender($fetchMode ""
And insert your condition there

PHP Code:
if($this->currentlevel == 0)
{
    return 
"Egg";

for example
(this in 1.3.3, not sure how if the newest version changed a lot...)
__________________


asp.net stole my soul.

Last edited by IntoRain; 11-26-2013 at 06:11 AM.
Reply With Quote
  #4  
Old 11-26-2013, 12:44 PM
draugluin's Avatar
draugluin draugluin is offline
Member
 
Join Date: Oct 2011
Location: germany
Posts: 120
Gender: Unknown/Other
Credits: 10,819
draugluin is on a distinguished road
Default

@ HoF

I've modified the Mys 1.3.1 alike. (looks like
Quote:
if($row->currentlevel <= 4) $row->gender = 'unknown';
In 1.3.3 I don't know, where I have to insert this part.

@ Into Rain

aaaaaaaaaaaaaaah, yes. it was such a stupid fault ..."0"
But you helped me very much. thank you so much.
I needed just a big thought-provoking impulse

Last edited by draugluin; 11-26-2013 at 12:51 PM.
Reply With Quote
  #5  
Old 11-26-2013, 01:01 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: 328,999
Hall of Famer is on a distinguished road
Default

Well Mys v1.3.3 is much more object oriented than Mys v1.3.1, so the old techniques may not work on the newer versions. In fact, Mys v1.4.0 and the future versions will pretty much require you to use objects all the time, its a good thing I believe.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #6  
Old 11-27-2013, 09:11 AM
draugluin's Avatar
draugluin draugluin is offline
Member
 
Join Date: Oct 2011
Location: germany
Posts: 120
Gender: Unknown/Other
Credits: 10,819
draugluin is on a distinguished road
Default

@ Hof

I'm looking foreward to Mys 1.4.0.

to conform the new script is not such a big problem, I've needed just a tip.




And I will be glad, if you can help with another "problem":

I want the alternate image for the females.
So ... If the randomgenerator create a adoptable female, is it possible to insert automatically "yes" into the field "usealternates" ?
and if so ... where ? and how ?

Last edited by draugluin; 11-27-2013 at 09:14 AM.
Reply With Quote
  #7  
Old 11-29-2013, 01:03 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,309
IntoRain is on a distinguished road
Default

Quote:
Originally Posted by draugluin View Post
@ Hof

I'm looking foreward to Mys 1.4.0.

to conform the new script is not such a big problem, I've needed just a tip.




And I will be glad, if you can help with another "problem":

I want the alternate image for the females.
So ... If the randomgenerator create a adoptable female, is it possible to insert automatically "yes" into the field "usealternates" ?
and if so ... where ? and how ?
When a new object is a created you can put a condition if gender == female, update database, which is with that function $mysidia->db->update(...). I don't really remember it that well though, but it must be in some files when you change information (like adoptables name and stuff)
__________________


asp.net stole my soul.
Reply With Quote
  #8  
Old 12-05-2013, 06:05 AM
draugluin's Avatar
draugluin draugluin is offline
Member
 
Join Date: Oct 2011
Location: germany
Posts: 120
Gender: Unknown/Other
Credits: 10,819
draugluin is on a distinguished road
Default

@ IntoRain

update- that's an idea. I try it... thank you
Reply With Quote
Reply

Thread Tools
Display Modes

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 04:25 AM.

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