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-24-2015, 11:42 PM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,766
Hwona is on a distinguished road
Default Calling a function in a function from the same class page

Hello, I'm currently trying to edit the code in the class_owned_adoptables files and am trying to call the "getNextLevel" function in another function, but I can't get the function to return a value. Does anyone know a way around this or a way to call the function within a function in the same file? I'm using v1.3.3. Thank you!

The code is something like this in the function that calles the "getNextLevel" function:

public function code{
$nextlevel = $this->getNextLevel();
$document->add(new Comment($nextlevel));
}

No value is returned.
__________________

Last edited by Hwona; 04-24-2015 at 11:59 PM.
Reply With Quote
  #2  
Old 04-25-2015, 02:19 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 88,352
Kyttias is on a distinguished road
Default

Does the pet you are looking at have a next level? For example, the maximum level I have on my test site for pets is level 4. If the pet is level 4, it has no next level, and therefore calling getNextLevel() would make the function, and therefore the variable holding the function, hold the value of FALSE, an empty value.

My recommended use of getNextLevel() would be something like:
PHP Code:
if($this->hasNextLevel()){
    
$level $this->getNextLevel();
    
$levelupClicks $this->getLevelupClicks();
    
$toNext "(LVL ".$level->getLevel()." in ".$levelupClicks." more EXP)"
}
else 
$toNext "(MAX)"
and then returning $toNext. But I'm dealing with v1.3.4, and I'm not sure how different things are. I'm currently doing the above in getStats(), another function in the ownedadoptables class.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.

Last edited by Kyttias; 04-25-2015 at 02:21 AM.
Reply With Quote
  #3  
Old 04-25-2015, 08:41 AM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,766
Hwona is on a distinguished road
Default Re

Thank you so much Kyttias! For some reason, that works perfectly! :D
__________________
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
Help with a item function kristhasirah Questions and Supports 35 04-03-2017 10:17 AM
Item Function Suggestions NobodysHero Suggestions and Feature Requests 5 06-23-2014 03:45 AM
Add a new function in the myadopts page? Infernette Questions and Supports 8 07-02-2013 12:12 PM
Help in PHP function lovejenete Other Chat 3 12-06-2009 08:46 AM


All times are GMT -5. The time now is 07:58 AM.

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