Mys 1.3.3 - modify script -

Forum
Last Post
Threads / Messages

draugluin

Member
Member
Joined
Oct 26, 2011
Messages
120
Points
16
Location
germany
Mysidian Dollar
7,683
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:
 $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...
 
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.
 
PHP:
 $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:
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:
$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:
$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:
protected $currentlevel;

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

PHP:
public function getGender($fetchMode = "")

And insert your condition there

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

for example
(this in 1.3.3, not sure how if the newest version changed a lot...)
 
Last edited:
@ HoF

I've modified the Mys 1.3.1 alike. (looks like
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:
 
Last edited:
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.
 
@ 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:
 
Last edited:
@ 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)
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,118
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Top