Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Mys 1.3.3 - modify script - (http://www.mysidiaadoptables.com/forum/showthread.php?t=4307)

draugluin 11-25-2013 09:56 AM

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...

Hall of Famer 11-25-2013 11:18 AM

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.

IntoRain 11-26-2013 05:55 AM

Quote:

Originally Posted by draugluin (Post 28470)

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...)

draugluin 11-26-2013 12:44 PM

@ 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. :usedusedused:
I needed just a big thought-provoking impulse :wutno:

Hall of Famer 11-26-2013 01:01 PM

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.

draugluin 11-27-2013 09:11 AM

@ 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 ? :smile:

IntoRain 11-29-2013 01:03 PM

Quote:

Originally Posted by draugluin (Post 28531)
@ 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 ? :smile:

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)

draugluin 12-05-2013 06:05 AM

@ IntoRain

update- that's an idea. I try it... thank you :happycbig:


All times are GMT -5. The time now is 09:07 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.